summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSandeep Patel <deeppatel1987@gmail.com>2009-10-15 22:25:32 +0000
committerSandeep Patel <deeppatel1987@gmail.com>2009-10-15 22:25:32 +0000
commit452b54a8aebee45088b2157a66ae0f9f6a9088fa (patch)
tree0e8d8cf8e003832572d17339e9e9bcf19ccb6435 /lib
parent6f122625dde52dd112ca18cc016e4846734b9a4f (diff)
downloadllvm-452b54a8aebee45088b2157a66ae0f9f6a9088fa.tar.gz
llvm-452b54a8aebee45088b2157a66ae0f9f6a9088fa.tar.bz2
llvm-452b54a8aebee45088b2157a66ae0f9f6a9088fa.tar.xz
Branches must be the last instruction in a Thumb2 IT block. Approved by Evan Cheng.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84212 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Target/ARM/Thumb2ITBlockPass.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Target/ARM/Thumb2ITBlockPass.cpp b/lib/Target/ARM/Thumb2ITBlockPass.cpp
index 98b5cbdfb9..427c0bb22b 100644
--- a/lib/Target/ARM/Thumb2ITBlockPass.cpp
+++ b/lib/Target/ARM/Thumb2ITBlockPass.cpp
@@ -107,8 +107,12 @@ bool Thumb2ITBlockPass::InsertITBlocks(MachineBasicBlock &MBB) {
// Finalize IT mask.
ARMCC::CondCodes OCC = ARMCC::getOppositeCondition(CC);
unsigned Mask = 0, Pos = 3;
- while (MBBI != E && Pos) {
+ // Branches, including tricky ones like LDM_RET, need to end an IT
+ // block so check the instruction we just put in the block.
+ while (MBBI != E && Pos &&
+ (!MI->getDesc().isBranch() && !MI->getDesc().isReturn())) {
MachineInstr *NMI = &*MBBI;
+ MI = NMI;
DebugLoc ndl = NMI->getDebugLoc();
unsigned NPredReg = 0;
ARMCC::CondCodes NCC = getPredicate(NMI, NPredReg);