Improve a hotspot that was making build_sets() slower by calling lookup() too

often.  This improves Anton's testcase from 36s to 32s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@38441 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2007-07-09 07:56:55 +00:00
parent 0793b36fd6
commit b9eeb1acbc

View File

@ -574,6 +574,10 @@ class ValueNumberedSet {
numbers.set(i);
}
void copyNumbers(ValueNumberedSet& other) {
numbers = other.numbers;
}
void reset(unsigned i) {
if (i < numbers.size())
numbers.reset(i);
@ -1455,13 +1459,12 @@ void GVNPRE::buildsets(Function& F) {
BasicBlock* BB = DI->getBlock();
// A block inherits AVAIL_OUT from its dominator
if (DI->getIDom() != 0)
if (DI->getIDom() != 0) {
currAvail.insert(availableOut[DI->getIDom()->getBlock()].begin(),
availableOut[DI->getIDom()->getBlock()].end());
for (ValueNumberedSet::iterator I = currAvail.begin(),
E = currAvail.end(); I != E; ++I)
currAvail.set(VN.lookup(*I));
currAvail.copyNumbers(availableOut[DI->getIDom()->getBlock()]);
}
for (BasicBlock::iterator BI = BB->begin(), BE = BB->end();
BI != BE; ++BI)