[llvm-branch-commits] [llvm-branch] r93912 - in /llvm/branches/Apple/Zoidberg: lib/Target/ARM/Thumb1RegisterInfo.cpp lib/Target/ARM/Thumb2InstrInfo.cpp test/CodeGen/Thumb2/2010-01-19-RemovePredicates.ll

Jakob Stoklund Olesen stoklund at 2pi.dk
Tue Jan 19 13:17:44 PST 2010


Author: stoklund
Date: Tue Jan 19 15:17:44 2010
New Revision: 93912

URL: http://llvm.org/viewvc/llvm-project?rev=93912&view=rev
Log:
Merge r93909

Added:
    llvm/branches/Apple/Zoidberg/test/CodeGen/Thumb2/2010-01-19-RemovePredicates.ll
      - copied unchanged from r93909, llvm/trunk/test/CodeGen/Thumb2/2010-01-19-RemovePredicates.ll
Modified:
    llvm/branches/Apple/Zoidberg/lib/Target/ARM/Thumb1RegisterInfo.cpp
    llvm/branches/Apple/Zoidberg/lib/Target/ARM/Thumb2InstrInfo.cpp

Modified: llvm/branches/Apple/Zoidberg/lib/Target/ARM/Thumb1RegisterInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/Target/ARM/Thumb1RegisterInfo.cpp?rev=93912&r1=93911&r2=93912&view=diff

==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/Target/ARM/Thumb1RegisterInfo.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/Target/ARM/Thumb1RegisterInfo.cpp Tue Jan 19 15:17:44 2010
@@ -479,11 +479,15 @@
              "Thumb add/sub sp, #imm immediate must be multiple of 4!");
     }
 
-    if (Offset == 0) {
+    unsigned PredReg;
+    if (Offset == 0 && getInstrPredicate(&MI, PredReg) == ARMCC::AL) {
       // Turn it into a move.
       MI.setDesc(TII.get(ARM::tMOVgpr2tgpr));
       MI.getOperand(i).ChangeToRegister(FrameReg, false);
-      MI.RemoveOperand(i+1);
+      // Remove offset and remaining explicit predicate operands.
+      do MI.RemoveOperand(i+1);
+      while (MI.getNumOperands() > i+1 &&
+             (!MI.getOperand(i+1).isReg() || !MI.getOperand(i+1).isImm()));
       return 0;
     }
 

Modified: llvm/branches/Apple/Zoidberg/lib/Target/ARM/Thumb2InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Zoidberg/lib/Target/ARM/Thumb2InstrInfo.cpp?rev=93912&r1=93911&r2=93912&view=diff

==============================================================================
--- llvm/branches/Apple/Zoidberg/lib/Target/ARM/Thumb2InstrInfo.cpp (original)
+++ llvm/branches/Apple/Zoidberg/lib/Target/ARM/Thumb2InstrInfo.cpp Tue Jan 19 15:17:44 2010
@@ -353,12 +353,16 @@
     Offset += MI.getOperand(FrameRegIdx+1).getImm();
 
     bool isSP = FrameReg == ARM::SP;
-    if (Offset == 0) {
+    unsigned PredReg;
+    if (Offset == 0 && getInstrPredicate(&MI, PredReg) == ARMCC::AL) {
       // Turn it into a move.
       MI.setDesc(TII.get(ARM::tMOVgpr2gpr));
       MI.getOperand(FrameRegIdx).ChangeToRegister(FrameReg, false);
-      MI.RemoveOperand(FrameRegIdx+1);
-      Offset = 0;
+      // Remove offset and remaining explicit predicate operands.
+      do MI.RemoveOperand(FrameRegIdx+1);
+      while (MI.getNumOperands() > FrameRegIdx+1 &&
+             (!MI.getOperand(FrameRegIdx+1).isReg() ||
+              !MI.getOperand(FrameRegIdx+1).isImm()));
       return true;
     }
 





More information about the llvm-branch-commits mailing list