Avoid folding ADD instructions with FI operands.
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 17 Aug 2012 20:55:34 +0000 (20:55 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 17 Aug 2012 20:55:34 +0000 (20:55 +0000)
PEI can't handle the pseudo-instructions. This can be removed when the
pseudo-instructions are replaced by normal predicated instructions.

Fixes PR13628.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162130 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMBaseInstrInfo.cpp
test/CodeGen/ARM/select_xform.ll

index 1cc5a17cb029796e0cfd26da9111cc00ded16464..64d80dc67ab82b3246b99a557210caefed0419d0 100644 (file)
@@ -1583,6 +1583,9 @@ static unsigned canFoldIntoMOVCC(unsigned Reg, MachineInstr *&MI,
   // predicated instructions which will be reading CPSR.
   for (unsigned i = 1, e = MI->getNumOperands(); i != e; ++i) {
     const MachineOperand &MO = MI->getOperand(i);
+    // Reject frame index operands, PEI can't handle the predicated pseudos.
+    if (MO.isFI() || MO.isCPI() || MO.isJTI())
+      return 0;
     if (!MO.isReg())
       continue;
     if (TargetRegisterInfo::isPhysicalRegister(MO.getReg()))
index 26f7cb68901fb2df7cfa4a99af6d3bc7666a2cfe..7f653d55733b423e9c0a1beadccddefbaa14971c 100644 (file)
@@ -179,3 +179,14 @@ define i32 @t12(i32 %a, i32 %b) nounwind {
   %tmp1 = select i1 %cond, i32 %a, i32 %x
   ret i32 %tmp1
 }
+
+; Handle frame index operands.
+define void @pr13628() nounwind uwtable align 2 {
+  %x3 = alloca i8, i32 256, align 8
+  %x4 = load i8* undef, align 1
+  %x5 = icmp ne i8 %x4, 0
+  %x6 = select i1 %x5, i8* %x3, i8* null
+  call void @bar(i8* %x6) nounwind
+  ret void
+}
+declare void @bar(i8*)