llvm.org GIT mirror llvm / ded71be
[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 Davide Italiano 3 years ago
1 changed file(s) with 1 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
766766 MachineBasicBlock *SuccBB) {
767767 const unsigned NumNew = BB->getNumber();
768768
769 SmallSet> Defs, Kills;
769 DenseSet> Defs, Kills;
770770
771771 MachineBasicBlock::iterator BBI = SuccBB->begin(), BBE = SuccBB->end();
772772 for (; BBI != BBE && BBI->isPHI(); ++BBI) {