mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-05-02 20:38:34 +00:00
Count correctly when a COPY turns into a spill or reload.
The number of spills could go negative since a folded COPY is just a spill, and it may be eliminated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139815 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1b69a128d6
commit
d205f7a940
@ -1002,6 +1002,7 @@ bool InlineSpiller::coalesceStackAccess(MachineInstr *MI, unsigned Reg) {
|
|||||||
bool InlineSpiller::foldMemoryOperand(MachineBasicBlock::iterator MI,
|
bool InlineSpiller::foldMemoryOperand(MachineBasicBlock::iterator MI,
|
||||||
const SmallVectorImpl<unsigned> &Ops,
|
const SmallVectorImpl<unsigned> &Ops,
|
||||||
MachineInstr *LoadMI) {
|
MachineInstr *LoadMI) {
|
||||||
|
bool WasCopy = MI->isCopy();
|
||||||
// TargetInstrInfo::foldMemoryOperand only expects explicit, non-tied
|
// TargetInstrInfo::foldMemoryOperand only expects explicit, non-tied
|
||||||
// operands.
|
// operands.
|
||||||
SmallVector<unsigned, 8> FoldOps;
|
SmallVector<unsigned, 8> FoldOps;
|
||||||
@ -1031,7 +1032,12 @@ bool InlineSpiller::foldMemoryOperand(MachineBasicBlock::iterator MI,
|
|||||||
VRM.addSpillSlotUse(StackSlot, FoldMI);
|
VRM.addSpillSlotUse(StackSlot, FoldMI);
|
||||||
MI->eraseFromParent();
|
MI->eraseFromParent();
|
||||||
DEBUG(dbgs() << "\tfolded: " << *FoldMI);
|
DEBUG(dbgs() << "\tfolded: " << *FoldMI);
|
||||||
++NumFolded;
|
if (!WasCopy)
|
||||||
|
++NumFolded;
|
||||||
|
else if (Ops.front() == 0)
|
||||||
|
++NumSpills;
|
||||||
|
else
|
||||||
|
++NumReloads;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user