mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-11 10:25:41 +00:00
Only propagate IsKill if the last use is a kill.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34878 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -703,15 +703,19 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM) {
|
|||||||
|
|
||||||
// Extend the live range of the MI that last kill the register if
|
// Extend the live range of the MI that last kill the register if
|
||||||
// necessary.
|
// necessary.
|
||||||
|
bool WasKill = false;
|
||||||
if (SSMI) {
|
if (SSMI) {
|
||||||
MachineOperand *MOK = SSMI->findRegisterUseOperand(PhysReg, true);
|
MachineOperand *MOK = SSMI->findRegisterUseOperand(PhysReg, true);
|
||||||
if (MOK)
|
if (MOK) {
|
||||||
|
WasKill = MOK->isKill();
|
||||||
MOK->unsetIsKill();
|
MOK->unsetIsKill();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ti == -1) {
|
if (ti == -1) {
|
||||||
// Unless it's the use of a two-address code, transfer the kill
|
// Unless it's the use of a two-address code, transfer the kill
|
||||||
// of the reused register to this use.
|
// of the reused register to this use.
|
||||||
MI.getOperand(i).setIsKill();
|
if (WasKill)
|
||||||
|
MI.getOperand(i).setIsKill();
|
||||||
Spills.addLastUse(PhysReg, &MI);
|
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
|
// Extend the live range of the MI that last kill the register if
|
||||||
// necessary.
|
// necessary.
|
||||||
|
bool WasKill = false;
|
||||||
if (SSMI) {
|
if (SSMI) {
|
||||||
MachineOperand *MOK = SSMI->findRegisterUseOperand(PhysReg, true);
|
MachineOperand *MOK = SSMI->findRegisterUseOperand(PhysReg, true);
|
||||||
if (MOK)
|
if (MOK) {
|
||||||
|
WasKill = MOK->isKill();
|
||||||
MOK->unsetIsKill();
|
MOK->unsetIsKill();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MachineInstr *CopyMI = prior(MII);
|
MachineInstr *CopyMI = prior(MII);
|
||||||
MachineOperand *MOU = CopyMI->findRegisterUseOperand(PhysReg);
|
if (WasKill) {
|
||||||
MOU->setIsKill();
|
// Transfer kill to the next use.
|
||||||
Spills.addLastUse(PhysReg, &MI);
|
MachineOperand *MOU = CopyMI->findRegisterUseOperand(PhysReg);
|
||||||
|
MOU->setIsKill();
|
||||||
|
}
|
||||||
|
Spills.addLastUse(PhysReg, CopyMI);
|
||||||
|
|
||||||
// This invalidates DesignatedReg.
|
// This invalidates DesignatedReg.
|
||||||
Spills.ClobberPhysReg(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
|
// Either way, the live range of the last kill of InReg has been
|
||||||
// extended. Remove its kill.
|
// extended. Remove its kill.
|
||||||
|
bool WasKill = false;
|
||||||
if (SSMI) {
|
if (SSMI) {
|
||||||
MachineOperand *MOK = SSMI->findRegisterUseOperand(InReg, true);
|
MachineOperand *MOK = SSMI->findRegisterUseOperand(InReg, true);
|
||||||
if (MOK)
|
if (MOK) {
|
||||||
|
WasKill = MOK->isKill();
|
||||||
MOK->unsetIsKill();
|
MOK->unsetIsKill();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (NextMII != MBB.end()) {
|
if (NextMII != MBB.end()) {
|
||||||
// If NextMII uses InReg (must be the copy?), mark it killed.
|
// If NextMII uses InReg (must be the copy?), mark it killed.
|
||||||
MachineOperand *MOU = NextMII->findRegisterUseOperand(InReg);
|
MachineOperand *MOU = NextMII->findRegisterUseOperand(InReg);
|
||||||
if (MOU) {
|
if (MOU) {
|
||||||
MOU->setIsKill();
|
if (WasKill)
|
||||||
|
MOU->setIsKill();
|
||||||
Spills.addLastUse(InReg, &(*NextMII));
|
Spills.addLastUse(InReg, &(*NextMII));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user