aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/TwoAddressInstructionPass.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/TwoAddressInstructionPass.cpp')
-rw-r--r--lib/CodeGen/TwoAddressInstructionPass.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp
index 6144ecd002..017d8b772f 100644
--- a/lib/CodeGen/TwoAddressInstructionPass.cpp
+++ b/lib/CodeGen/TwoAddressInstructionPass.cpp
@@ -961,8 +961,14 @@ TryInstructionTransform(MachineBasicBlock::iterator &mi,
if (LV) {
for (unsigned i = 0, e = mi->getNumOperands(); i != e; ++i) {
MachineOperand &MO = mi->getOperand(i);
- if (MO.isReg() && MO.isUse() && MO.isKill())
- LV->replaceKillInstruction(Reg, mi, NewMIs[0]);
+ if (MO.isReg() && MO.getReg() != 0 &&
+ TargetRegisterInfo::isVirtualRegister(MO.getReg())) {
+ if (MO.isUse()) {
+ if (MO.isKill())
+ LV->replaceKillInstruction(MO.getReg(), mi, NewMIs[0]);
+ } else if (LV->removeVirtualRegisterDead(MO.getReg(), mi))
+ LV->addVirtualRegisterDead(MO.getReg(), NewMIs[1]);
+ }
}
LV->addVirtualRegisterKilled(Reg, NewMIs[1]);
}