Skip to content

Commit 48545b3

Browse files
committed
Merge in r114506.
llvm-svn: 115101
1 parent 31ee1f9 commit 48545b3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,8 @@ ConvertToSetZeroFlag(MachineInstr *MI, MachineInstr *CmpInstr) const {
13891389

13901390
// Check that CPSR isn't set between the comparison instruction and the one we
13911391
// want to change.
1392-
MachineBasicBlock::const_iterator I = CmpInstr, E = MI;
1392+
MachineBasicBlock::const_iterator I = CmpInstr, E = MI,
1393+
B = MI->getParent()->begin();
13931394
--I;
13941395
for (; I != E; --I) {
13951396
const MachineInstr &Instr = *I;
@@ -1403,6 +1404,10 @@ ConvertToSetZeroFlag(MachineInstr *MI, MachineInstr *CmpInstr) const {
14031404
if (MO.getReg() == ARM::CPSR)
14041405
return false;
14051406
}
1407+
1408+
if (I == B)
1409+
// The 'and' is below the comparison instruction.
1410+
return false;
14061411
}
14071412

14081413
// Set the "zero" bit in CPSR.

0 commit comments

Comments
 (0)