aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/VirtRegMap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CodeGen/VirtRegMap.cpp')
-rw-r--r--lib/CodeGen/VirtRegMap.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/CodeGen/VirtRegMap.cpp b/lib/CodeGen/VirtRegMap.cpp
index ceb4acee69..0f5c48aaa9 100644
--- a/lib/CodeGen/VirtRegMap.cpp
+++ b/lib/CodeGen/VirtRegMap.cpp
@@ -855,14 +855,15 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM) {
} else
DOUT << "Removing now-noop copy: " << MI;
- // Extend the live range of the MI that last kill the register if
- // the next MI reuse it.
+ // Either way, the live range of the last kill of InReg has been
+ // extended. Remove its kill.
MachineOperand *MOK = SSMI->findRegisterUseOperand(InReg, true);
if (MOK && NextMII != MBB.end()) {
+ MOK->unsetIsKill();
+ // If NextMII uses InReg (must be the copy?), mark it killed.
MachineOperand *MOU = NextMII->findRegisterUseOperand(InReg);
if (MOU) {
MOU->setIsKill();
- MOK->unsetIsKill();
Spills.UpdateLastUse(InReg, &(*NextMII));
}
}