mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Also eliminate redundant spills downstream of inserted reloads.
This can happen when multiple sibling registers are spilled after live range splitting. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127965 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
01a46c82e0
commit
682eed0da8
@ -466,6 +466,7 @@ bool InlineSpiller::hoistSpill(LiveInterval &SpillLI, MachineInstr *CopyMI) {
|
|||||||
/// eliminateRedundantSpills - SLI:VNI is known to be on the stack. Remove any
|
/// eliminateRedundantSpills - SLI:VNI is known to be on the stack. Remove any
|
||||||
/// redundant spills of this value in SLI.reg and sibling copies.
|
/// redundant spills of this value in SLI.reg and sibling copies.
|
||||||
void InlineSpiller::eliminateRedundantSpills(LiveInterval &SLI, VNInfo *VNI) {
|
void InlineSpiller::eliminateRedundantSpills(LiveInterval &SLI, VNInfo *VNI) {
|
||||||
|
assert(VNI && "Missing value");
|
||||||
SmallVector<std::pair<LiveInterval*, VNInfo*>, 8> WorkList;
|
SmallVector<std::pair<LiveInterval*, VNInfo*>, 8> WorkList;
|
||||||
WorkList.push_back(std::make_pair(&SLI, VNI));
|
WorkList.push_back(std::make_pair(&SLI, VNI));
|
||||||
LiveInterval &StackInt = LSS.getInterval(StackSlot);
|
LiveInterval &StackInt = LSS.getInterval(StackSlot);
|
||||||
@ -793,15 +794,22 @@ void InlineSpiller::spillAroundUses(unsigned Reg) {
|
|||||||
|
|
||||||
// Check for a sibling copy.
|
// Check for a sibling copy.
|
||||||
unsigned SibReg = isFullCopyOf(MI, Reg);
|
unsigned SibReg = isFullCopyOf(MI, Reg);
|
||||||
if (!isSibling(SibReg))
|
if (SibReg && isSibling(SibReg)) {
|
||||||
SibReg = 0;
|
if (Writes) {
|
||||||
|
// Hoist the spill of a sib-reg copy.
|
||||||
// Hoist the spill of a sib-reg copy.
|
if (hoistSpill(OldLI, MI)) {
|
||||||
if (SibReg && Writes && !Reads && hoistSpill(OldLI, MI)) {
|
// This COPY is now dead, the value is already in the stack slot.
|
||||||
// This COPY is now dead, the value is already in the stack slot.
|
MI->getOperand(0).setIsDead();
|
||||||
MI->getOperand(0).setIsDead();
|
DeadDefs.push_back(MI);
|
||||||
DeadDefs.push_back(MI);
|
continue;
|
||||||
continue;
|
}
|
||||||
|
} else {
|
||||||
|
// This is a reload for a sib-reg copy. Drop spills downstream.
|
||||||
|
SlotIndex Idx = LIS.getInstructionIndex(MI).getDefIndex();
|
||||||
|
LiveInterval &SibLI = LIS.getInterval(SibReg);
|
||||||
|
eliminateRedundantSpills(SibLI, SibLI.getVNInfoAt(Idx));
|
||||||
|
// The COPY will fold to a reload below.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to fold memory ops.
|
// Attempt to fold memory ops.
|
||||||
|
Loading…
Reference in New Issue
Block a user