[llvm-commits] CVS: llvm/lib/Target/TargetInstrInfo.cpp

Evan Cheng evan.cheng at apple.com
Wed Nov 15 12:56:17 PST 2006



Changes in directory llvm/lib/Target:

TargetInstrInfo.cpp updated: 1.21 -> 1.22
---
Log message:

commuteInstruction should propagate kill / dead info.

---
Diffs of the changes:  (+10 -0)

 TargetInstrInfo.cpp |   10 ++++++++++
 1 files changed, 10 insertions(+)


Index: llvm/lib/Target/TargetInstrInfo.cpp
diff -u llvm/lib/Target/TargetInstrInfo.cpp:1.21 llvm/lib/Target/TargetInstrInfo.cpp:1.22
--- llvm/lib/Target/TargetInstrInfo.cpp:1.21	Wed Nov  1 17:14:15 2006
+++ llvm/lib/Target/TargetInstrInfo.cpp	Wed Nov 15 14:56:03 2006
@@ -60,7 +60,17 @@
          "This only knows how to commute register operands so far");
   unsigned Reg1 = MI->getOperand(1).getReg();
   unsigned Reg2 = MI->getOperand(2).getReg();
+  bool Reg1IsKill = MI->getOperand(1).isKill();
+  bool Reg2IsKill = MI->getOperand(2).isKill();
   MI->getOperand(2).setReg(Reg1);
   MI->getOperand(1).setReg(Reg2);
+  if (Reg1IsKill)
+    MI->getOperand(2).setIsKill();
+  else
+    MI->getOperand(2).unsetIsKill();
+  if (Reg2IsKill)
+    MI->getOperand(1).setIsKill();
+  else
+    MI->getOperand(1).unsetIsKill();
   return MI;
 }






More information about the llvm-commits mailing list