diff options
author | Chris Lattner <sabre@nondot.org> | 2009-10-31 22:04:43 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-10-31 22:04:43 +0000 |
commit | a4b04210d4a838e5a48b0c128bdfe42c3055633f (patch) | |
tree | f5a7f861f8a3881ac34d81a1d611c4ceae6ce300 /lib/Transforms/Scalar/CodeGenPrepare.cpp | |
parent | 07d236ba8856e7dcd2c7fcb0446b95c6df4c22b5 (diff) |
llvm::SplitEdge should refuse to split an edge from an indirectbr.
Fix CodeGenPrepare to not try to split edges from indirectbr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85690 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/CodeGenPrepare.cpp')
-rw-r--r-- | lib/Transforms/Scalar/CodeGenPrepare.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/CodeGenPrepare.cpp b/lib/Transforms/Scalar/CodeGenPrepare.cpp index 42209b8cbe..9ca90c333a 100644 --- a/lib/Transforms/Scalar/CodeGenPrepare.cpp +++ b/lib/Transforms/Scalar/CodeGenPrepare.cpp @@ -318,6 +318,7 @@ static void SplitEdgeNicely(TerminatorInst *TI, unsigned SuccNum, if (Invoke->getSuccessor(1) == Dest) return; } + // As a hack, never split backedges of loops. Even though the copy for any // PHIs inserted on the backedge would be dead for exits from the loop, we @@ -852,7 +853,7 @@ bool CodeGenPrepare::OptimizeBlock(BasicBlock &BB) { // Split all critical edges where the dest block has a PHI. TerminatorInst *BBTI = BB.getTerminator(); - if (BBTI->getNumSuccessors() > 1) { + if (BBTI->getNumSuccessors() > 1 && !isa<IndirectBrInst>(BBTI)) { for (unsigned i = 0, e = BBTI->getNumSuccessors(); i != e; ++i) { BasicBlock *SuccBB = BBTI->getSuccessor(i); if (isa<PHINode>(SuccBB->begin()) && isCriticalEdge(BBTI, i, true)) |