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

Dan Gohman gohman at apple.com
Tue Aug 19 15:31:46 PDT 2008


Author: djg
Date: Tue Aug 19 17:31:46 2008
New Revision: 55014

URL: http://llvm.org/viewvc/llvm-project?rev=55014&view=rev
Log:
Support unconditional fall-through branches in FastISel.

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=55014&r1=55013&r2=55014&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/FastISel.cpp Tue Aug 19 17:31:46 2008
@@ -11,6 +11,7 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/Instructions.h"
 #include "llvm/CodeGen/FastISel.h"
 #include "llvm/CodeGen/MachineInstrBuilder.h"
 #include "llvm/CodeGen/MachineRegisterInfo.h"
@@ -41,6 +42,21 @@
       ValueMap[I] = ResultReg;
       break;
     }
+    case Instruction::Br: {
+      BranchInst *BI = cast<BranchInst>(I);
+
+      // 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;
+      }
+
+      // Something more complicated. Halt "fast" selection and bail.
+      return I;
+    }
     default:
       // Unhandled instruction. Halt "fast" selection and bail.
       return I;





More information about the llvm-commits mailing list