mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-29 10:25:12 +00:00
Yet another nasty spiller bug.
%ecx = op store %cl<kill>, (addr) (addr) = op %al It's not safe to unfold the last operand and eliminate store even though %cl is marked kill. It's a sub-register use which means one of its super-register(s) may be used below. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50794 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1465,20 +1465,25 @@ void LocalSpiller::RewriteMBB(MachineBasicBlock &MBB, VirtRegMap &VRM) {
|
||||
// the value and there isn't an earlier def that has already clobbered
|
||||
// the physreg.
|
||||
if (PhysReg &&
|
||||
!TII->isStoreToStackSlot(&MI, SS) && // Not profitable!
|
||||
DeadStore->killsRegister(PhysReg) &&
|
||||
TII->unfoldMemoryOperand(MF, &MI, PhysReg, false, true, NewMIs)) {
|
||||
MBB.insert(MII, NewMIs[0]);
|
||||
NewStore = NewMIs[1];
|
||||
MBB.insert(MII, NewStore);
|
||||
VRM.addSpillSlotUse(SS, NewStore);
|
||||
VRM.RemoveMachineInstrFromMaps(&MI);
|
||||
MBB.erase(&MI);
|
||||
Erased = true;
|
||||
--NextMII;
|
||||
--NextMII; // backtrack to the unfolded instruction.
|
||||
BackTracked = true;
|
||||
isDead = true;
|
||||
!TII->isStoreToStackSlot(&MI, SS)) { // Not profitable!
|
||||
MachineOperand *KillOpnd =
|
||||
DeadStore->findRegisterUseOperand(PhysReg, true);
|
||||
// Note, if the store is storing a sub-register, it's possible the
|
||||
// super-register is needed below.
|
||||
if (KillOpnd && !KillOpnd->getSubReg() &&
|
||||
TII->unfoldMemoryOperand(MF, &MI, PhysReg, false, true,NewMIs)){
|
||||
MBB.insert(MII, NewMIs[0]);
|
||||
NewStore = NewMIs[1];
|
||||
MBB.insert(MII, NewStore);
|
||||
VRM.addSpillSlotUse(SS, NewStore);
|
||||
VRM.RemoveMachineInstrFromMaps(&MI);
|
||||
MBB.erase(&MI);
|
||||
Erased = true;
|
||||
--NextMII;
|
||||
--NextMII; // backtrack to the unfolded instruction.
|
||||
BackTracked = true;
|
||||
isDead = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user