summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-07-19 22:59:41 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-07-19 22:59:41 +0000
commit55d6ccbb79bad50258a2131b258bd9e36162b175 (patch)
tree781e1b9e785831d090c8b1dbc69a80e205bb7277 /llvm/lib/Transforms
parent46d9cd5f72a36a142eabc15a092b82785b4ee4f4 (diff)
downloadbcm5719-llvm-55d6ccbb79bad50258a2131b258bd9e36162b175.tar.gz
bcm5719-llvm-55d6ccbb79bad50258a2131b258bd9e36162b175.zip
PR10386: Don't try to split an edge from an indirectbr.
llvm-svn: 135534
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp b/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp
index 92ce50030a5..803e431f761 100644
--- a/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp
+++ b/llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp
@@ -337,6 +337,8 @@ BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
}
// For each unique exit block...
+ // FIXME: This code is functionally equivalent to the corresponding
+ // loop in LoopSimplify.
SmallVector<BasicBlock *, 4> ExitBlocks;
TIL->getExitBlocks(ExitBlocks);
for (unsigned i = 0, e = ExitBlocks.size(); i != e; ++i) {
@@ -348,10 +350,15 @@ BasicBlock *llvm::SplitCriticalEdge(TerminatorInst *TI, unsigned SuccNum,
for (pred_iterator I = pred_begin(Exit), E = pred_end(Exit);
I != E; ++I) {
BasicBlock *P = *I;
- if (TIL->contains(P))
+ if (TIL->contains(P)) {
+ if (isa<IndirectBrInst>(P->getTerminator())) {
+ Preds.clear();
+ break;
+ }
Preds.push_back(P);
- else
+ } else {
HasPredOutsideOfLoop = true;
+ }
}
// If there are any preds not in the loop, we'll need to split
// the edges. The Preds.empty() check is needed because a block
OpenPOWER on IntegriCloud