commuteInstruction should preserve dead markers.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 3 Jul 2008 00:04:51 +0000 (00:04 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 3 Jul 2008 00:04:51 +0000 (00:04 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53060 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86InstrInfo.cpp

index 969a05c580a051f105730595c94fd38fdd2db2e7..2a3f1cbb6817a07f75c807357dfc3083a1b58bfb 100644 (file)
@@ -1214,6 +1214,7 @@ X86InstrInfo::commuteInstruction(MachineInstr *MI, bool NewMI) const {
     unsigned A = MI->getOperand(0).getReg();
     unsigned B = MI->getOperand(1).getReg();
     unsigned C = MI->getOperand(2).getReg();
+    bool AisDead = MI->getOperand(0).isDead();
     bool BisKill = MI->getOperand(1).isKill();
     bool CisKill = MI->getOperand(2).isKill();
     // If machine instrs are no longer in two-address forms, update
@@ -1225,7 +1226,8 @@ X86InstrInfo::commuteInstruction(MachineInstr *MI, bool NewMI) const {
       A = C;
       CisKill = false;
     }
-    return BuildMI(get(Opc), A).addReg(C, false, false, CisKill)
+    return BuildMI(get(Opc)).addReg(A, true, false, false, AisDead)
+      .addReg(C, false, false, CisKill)
       .addReg(B, false, false, BisKill).addImm(Size-Amt);
   }
   case X86::CMOVB16rr: