summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/VirtRegMap.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2007-03-03 06:32:37 +0000
committerEvan Cheng <evan.cheng@apple.com>2007-03-03 06:32:37 +0000
commitd74cb0e19449810667183c95a31f409b23807705 (patch)
tree2b0490009d6f9c6f38951b8c43b67173f8a16df4 /llvm/lib/CodeGen/VirtRegMap.cpp
parent54c6e84c8374d6ee3a10e2ac26bf4c873791be38 (diff)
downloadbcm5719-llvm-d74cb0e19449810667183c95a31f409b23807705.tar.gz
bcm5719-llvm-d74cb0e19449810667183c95a31f409b23807705.zip
Only propagate IsKill if the last use is a kill.
llvm-svn: 34878
Diffstat (limited to 'llvm/lib/CodeGen/VirtRegMap.cpp')
-rw-r--r--llvm/lib/CodeGen/VirtRegMap.cpp30
1 files changed, 22 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp
index 66633facf9e..9a1e58f58ac 100644
--- a/llvm/lib/CodeGen/VirtRegMap.cpp
+++ b/llvm/lib/CodeGen/VirtRegMap.cpp
@@ -703,15 +703,19 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM) {
// Extend the live range of the MI that last kill the register if
// necessary.
+ bool WasKill = false;
if (SSMI) {
MachineOperand *MOK = SSMI->findRegisterUseOperand(PhysReg, true);
- if (MOK)
+ if (MOK) {
+ WasKill = MOK->isKill();
MOK->unsetIsKill();
+ }
}
if (ti == -1) {
// Unless it's the use of a two-address code, transfer the kill
// of the reused register to this use.
- MI.getOperand(i).setIsKill();
+ if (WasKill)
+ MI.getOperand(i).setIsKill();
Spills.addLastUse(PhysReg, &MI);
}
@@ -782,15 +786,21 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM) {
// Extend the live range of the MI that last kill the register if
// necessary.
+ bool WasKill = false;
if (SSMI) {
MachineOperand *MOK = SSMI->findRegisterUseOperand(PhysReg, true);
- if (MOK)
+ if (MOK) {
+ WasKill = MOK->isKill();
MOK->unsetIsKill();
+ }
}
MachineInstr *CopyMI = prior(MII);
- MachineOperand *MOU = CopyMI->findRegisterUseOperand(PhysReg);
- MOU->setIsKill();
- Spills.addLastUse(PhysReg, &MI);
+ if (WasKill) {
+ // Transfer kill to the next use.
+ MachineOperand *MOU = CopyMI->findRegisterUseOperand(PhysReg);
+ MOU->setIsKill();
+ }
+ Spills.addLastUse(PhysReg, CopyMI);
// This invalidates DesignatedReg.
Spills.ClobberPhysReg(DesignatedReg);
@@ -877,16 +887,20 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM) {
// Either way, the live range of the last kill of InReg has been
// extended. Remove its kill.
+ bool WasKill = false;
if (SSMI) {
MachineOperand *MOK = SSMI->findRegisterUseOperand(InReg, true);
- if (MOK)
+ if (MOK) {
+ WasKill = MOK->isKill();
MOK->unsetIsKill();
+ }
}
if (NextMII != MBB.end()) {
// If NextMII uses InReg (must be the copy?), mark it killed.
MachineOperand *MOU = NextMII->findRegisterUseOperand(InReg);
if (MOU) {
- MOU->setIsKill();
+ if (WasKill)
+ MOU->setIsKill();
Spills.addLastUse(InReg, &(*NextMII));
}
}
OpenPOWER on IntegriCloud