diff options
author | Owen Anderson <resistor@mac.com> | 2008-07-16 17:52:31 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-07-16 17:52:31 +0000 |
commit | 5d0af038a718ff31b1ecf0894bae951e41960e0d (patch) | |
tree | dbcafafe3e3c5d4a378754e648a71afcc83205ab /lib/Transforms | |
parent | 5af8f0e67e407437709f4011295fa324d1e00316 (diff) | |
download | external_llvm-5d0af038a718ff31b1ecf0894bae951e41960e0d.zip external_llvm-5d0af038a718ff31b1ecf0894bae951e41960e0d.tar.gz external_llvm-5d0af038a718ff31b1ecf0894bae951e41960e0d.tar.bz2 |
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
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 7bbfbad..986d755 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -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; } |