summaryrefslogtreecommitdiff
path: root/lib/Target/ARM
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-10-22 23:30:04 +0000
committerBill Wendling <isanbard@gmail.com>2012-10-22 23:30:04 +0000
commit8f47fc8f00fbb1cc2215fc90942b0948e3ca121b (patch)
tree471ce388123c90e9fb98987a959ec6368db82346 /lib/Target/ARM
parent3ed0316f756e2f1730f46654776fcf77f5ace7aa (diff)
downloadllvm-8f47fc8f00fbb1cc2215fc90942b0948e3ca121b.tar.gz
llvm-8f47fc8f00fbb1cc2215fc90942b0948e3ca121b.tar.bz2
llvm-8f47fc8f00fbb1cc2215fc90942b0948e3ca121b.tar.xz
When a block ends in an indirect branch, add its successors to the machine basic block.
The CFG of the machine function needs to know that the targets of the indirect branch are successors to the indirect branch. <rdar://problem/12529625> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166448 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM')
-rw-r--r--lib/Target/ARM/ARMFastISel.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Target/ARM/ARMFastISel.cpp b/lib/Target/ARM/ARMFastISel.cpp
index 92248f5317..89b85d09b7 100644
--- a/lib/Target/ARM/ARMFastISel.cpp
+++ b/lib/Target/ARM/ARMFastISel.cpp
@@ -1388,6 +1388,11 @@ bool ARMFastISel::SelectIndirectBr(const Instruction *I) {
unsigned Opc = isThumb2 ? ARM::tBRIND : ARM::BX;
AddOptionalDefs(BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, DL, TII.get(Opc))
.addReg(AddrReg));
+
+ const IndirectBrInst *IB = cast<IndirectBrInst>(I);
+ for (unsigned i = 0, e = IB->getNumSuccessors(); i != e; ++i)
+ FuncInfo.MBB->addSuccessor(FuncInfo.MBBMap[IB->getSuccessor(i)]);
+
return true;
}