diff options
author | Chris Lattner <sabre@nondot.org> | 2009-10-31 22:11:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-10-31 22:11:15 +0000 |
commit | fb6e701f08d7ec065222abbbc6727dc80de3d17e (patch) | |
tree | 939ae821faee96d0bbc939637199b97b4bb9d5f5 | |
parent | 199a4b4c706289a87fceb711512ec5c8a9f23d7e (diff) |
Make sure PRE doesn't split crit edges from indirectbr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85692 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Transforms/Scalar/GVN.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp index 33ad4e1059..0e3f7507da 100644 --- a/lib/Transforms/Scalar/GVN.cpp +++ b/lib/Transforms/Scalar/GVN.cpp @@ -1810,7 +1810,7 @@ bool GVN::processBlock(BasicBlock *BB) { /// performPRE - Perform a purely local form of PRE that looks for diamond /// control flow patterns and attempts to perform simple PRE at the join point. -bool GVN::performPRE(Function& F) { +bool GVN::performPRE(Function &F) { bool Changed = false; SmallVector<std::pair<TerminatorInst*, unsigned>, 4> toSplit; DenseMap<BasicBlock*, Value*> predMap; @@ -1875,6 +1875,10 @@ bool GVN::performPRE(Function& F) { // we would need to insert instructions in more than one pred. if (NumWithout != 1 || NumWith == 0) continue; + + // Don't do PRE across indirect branch. + if (isa<IndirectBrInst>(PREPred->getTerminator())) + continue; // We can't do PRE safely on a critical edge, so instead we schedule // the edge to be split and perform the PRE the next time we iterate |