OSDN Git Service

[LiveVariables] Switch Kill/Defs sets to be DenseSet(s).
authorDavide Italiano <davide@freebsd.org>
Thu, 11 May 2017 19:37:43 +0000 (19:37 +0000)
committerDavide Italiano <davide@freebsd.org>
Thu, 11 May 2017 19:37:43 +0000 (19:37 +0000)
commitded71be5b118e69172da50a3c825f5593a29507b
treefc1cbeea6899b0d18eda03d7493e7dff5d1aaed0
parent483eed9183319f6a08fcf19a907e1905eb63a080
[LiveVariables] Switch Kill/Defs sets to be DenseSet(s).

The testcase in PR32984 shows a non linear compile time increase
after a change that made the LoopUnroll pass more aggressive
(increasing the threshold).

My profiling shows all the time of PHI elimination goes to
llvm::LiveVariables::addNewBlock. This is because we keep
Defs/Kills registers in a SmallSet and vfind(const T &V); is O(N).

Switching to a DenseSet reduces the time spent in the pass from
297 seconds to 97 seconds. Profiling still shows a lot of time is
spent iterating the data structure, so I guess there's room for
improvement.

Dan tells me GCC uses real set operations for live registers and
it takes no-time on this testcase. Matthias points out we might
want to switch all this to LiveIntervalAnalysis so it's not entirely
sure if a rewrite is worth it.

Differential Revision:  https://reviews.llvm.org/D33088

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302819 91177308-0d34-0410-b5e6-96231b3b80d8
lib/CodeGen/LiveVariables.cpp