add support for inserting an uncond branch
authorChris Lattner <sabre@nondot.org>
Tue, 17 Oct 2006 18:06:55 +0000 (18:06 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 17 Oct 2006 18:06:55 +0000 (18:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31003 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCInstrInfo.cpp

index ddb9dbf3162765fdd38e4b57c61cd096b7f4df91..9bf0746a2a2ebb63a093709fc65051952fe6d361 100644 (file)
@@ -238,8 +238,14 @@ void PPCInstrInfo::RemoveBranch(MachineBasicBlock &MBB) const {
 void PPCInstrInfo::InsertBranch(MachineBasicBlock &MBB, MachineBasicBlock *TBB,
                                 MachineBasicBlock *FBB,
                                 const std::vector<MachineOperand> &Cond) const {
-  // Fall through?
-  if (TBB == 0 && FBB == 0) return;
+  // Shouldn't be a fall through.
+  assert(TBB && "InsertBranch must not be told to insert a fallthrough");
+  
+  // Unconditional branch?
+  if (FBB == 0) {
+    BuildMI(&MBB, PPC::B, 1).addMBB(TBB);
+    return;
+  }
   
   assert(Cond.size() == 2 && "PPC branch conditions have two components!");