[llvm-commits] [llvm] r55033 - /llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp

Dan Gohman gohman at apple.com
Tue Aug 19 18:17:01 PDT 2008


Author: djg
Date: Tue Aug 19 20:17:01 2008
New Revision: 55033

URL: http://llvm.org/viewvc/llvm-project?rev=55033&view=rev
Log:
Fix FastISel to recognize that the last block in the function does
not have a fall-through successor.

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp?rev=55033&r1=55032&r2=55033&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Tue Aug 19 20:17:01 2008
@@ -104,11 +104,14 @@
 
       // 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.





More information about the llvm-commits mailing list