summaryrefslogtreecommitdiffstats
path: root/llvm/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
commite8f9a004244b214c4a33f1370b3aaa8a9b1a6c05 (patch)
treeed19041b502c8c875bce5bf69230aa661e1995be /llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
parent5dd15a3c45c650fbe99b32dffa305b72f322d6c1 (diff)
downloadbcm5719-llvm-e8f9a004244b214c4a33f1370b3aaa8a9b1a6c05.tar.gz
bcm5719-llvm-e8f9a004244b214c4a33f1370b3aaa8a9b1a6c05.zip
Fix FastISel to recognize that the last block in the function does
not have a fall-through successor. llvm-svn: 55033
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/FastISel.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/FastISel.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index e56747a89c1..cd6e2a2a313 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/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.
OpenPOWER on IntegriCloud