aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/SelectionDAG/FastISel.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-08-20 01:17:01 +0000
committerDan Gohman <gohman@apple.com>2008-08-20 01:17:01 +0000
commite6798b757acb3a2077c2498e9913fff2f5e4325c (patch)
tree5a56625320f8eae178d857906eb108637201fb74 /lib/CodeGen/SelectionDAG/FastISel.cpp
parentcc8430f742b0f1e567292c8a776e94fc1c930b2a (diff)
Fix FastISel to recognize that the last block in the function does
not have a fall-through successor. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55033 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r--lib/CodeGen/SelectionDAG/FastISel.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/CodeGen/SelectionDAG/FastISel.cpp b/lib/CodeGen/SelectionDAG/FastISel.cpp
index e56747a89c..cd6e2a2a31 100644
--- a/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -104,11 +104,14 @@ FastISel::SelectInstructions(BasicBlock::iterator Begin, BasicBlock::iterator En
// For now, check for and handle just the most trivial case: an
// unconditional fall-through branch.
- if (BI->isUnconditional() &&
- next(MachineFunction::iterator(MBB))->getBasicBlock() ==
- BI->getSuccessor(0)) {
- MBB->addSuccessor(next(MachineFunction::iterator(MBB)));
- break;
+ if (BI->isUnconditional()) {
+ MachineFunction::iterator NextMBB =
+ next(MachineFunction::iterator(MBB));
+ if (NextMBB != MF->end() &&
+ NextMBB->getBasicBlock() == BI->getSuccessor(0)) {
+ MBB->addSuccessor(NextMBB);
+ break;
+ }
}
// Something more complicated. Halt "fast" selection and bail.