aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2006-11-15 20:56:03 +0000
committerEvan Cheng <evan.cheng@apple.com>2006-11-15 20:56:03 +0000
commitff608a7a691af31a0cd0413993c0d3aa8c4e7de4 (patch)
treee08b835448bf44ddee5e5432825290af41216a94
parentddee8420622db50f7714c7a17188449c395a4392 (diff)
commuteInstruction should propagate kill / dead info.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31763 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/TargetInstrInfo.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Target/TargetInstrInfo.cpp b/lib/Target/TargetInstrInfo.cpp
index d28f1e7c50..cc637ed406 100644
--- a/lib/Target/TargetInstrInfo.cpp
+++ b/lib/Target/TargetInstrInfo.cpp
@@ -60,7 +60,17 @@ MachineInstr *TargetInstrInfo::commuteInstruction(MachineInstr *MI) const {
"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;
}