There's no need to iterate block merging and PRE. In fact, iterating the latter

could cause problems for memdep when it breaks critical edges.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53691 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Owen Anderson 2008-07-16 17:52:31 +00:00
parent 5af8f0e67e
commit 5d0af038a7

View File

@ -727,7 +727,6 @@ namespace {
AU.addPreserved<DominatorTree>();
AU.addPreserved<AliasAnalysis>();
AU.addPreserved<MemoryDependenceAnalysis>();
}
// Helper fuctions
@ -1121,11 +1120,22 @@ bool GVN::runOnFunction(Function& F) {
bool changed = false;
bool shouldContinue = true;
// Merge unconditional branches, allowing PRE to catch more
// optimization opportunities.
for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ) {
BasicBlock* BB = FI;
++FI;
changed |= mergeBlockIntoPredecessor(BB);
}
while (shouldContinue) {
shouldContinue = iterateOnFunction(F);
changed |= shouldContinue;
}
if (EnablePRE)
changed |= performPRE(F);
return changed;
}
@ -1382,15 +1392,6 @@ bool GVN::iterateOnFunction(Function &F) {
VN.clear();
phiMap.clear();
// Merge unconditional branches, allowing PRE to catch more
// optimization opportunities.
bool mergedBlocks = false;
for (Function::iterator FI = F.begin(), FE = F.end(); FI != FE; ) {
BasicBlock* BB = FI;
++FI;
mergedBlocks |= mergeBlockIntoPredecessor(BB);
}
for (DenseMap<BasicBlock*, ValueNumberScope*>::iterator
I = localAvail.begin(), E = localAvail.end(); I != E; ++I)
delete I->second;
@ -1404,8 +1405,5 @@ bool GVN::iterateOnFunction(Function &F) {
DE = df_end(DT.getRootNode()); DI != DE; ++DI)
changed |= processBlock(*DI);
if (EnablePRE)
changed |= performPRE(F);
return changed || mergedBlocks;
return changed;
}