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. llvm-svn: 139815
This commit is contained in:
parent
2d910ba1e5
commit
c94c967656
|
@ -1002,6 +1002,7 @@ bool InlineSpiller::coalesceStackAccess(MachineInstr *MI, unsigned Reg) {
|
|||
bool InlineSpiller::foldMemoryOperand(MachineBasicBlock::iterator MI,
|
||||
const SmallVectorImpl<unsigned> &Ops,
|
||||
MachineInstr *LoadMI) {
|
||||
bool WasCopy = MI->isCopy();
|
||||
// TargetInstrInfo::foldMemoryOperand only expects explicit, non-tied
|
||||
// operands.
|
||||
SmallVector<unsigned, 8> FoldOps;
|
||||
|
@ -1031,7 +1032,12 @@ bool InlineSpiller::foldMemoryOperand(MachineBasicBlock::iterator MI,
|
|||
VRM.addSpillSlotUse(StackSlot, FoldMI);
|
||||
MI->eraseFromParent();
|
||||
DEBUG(dbgs() << "\tfolded: " << *FoldMI);
|
||||
++NumFolded;
|
||||
if (!WasCopy)
|
||||
++NumFolded;
|
||||
else if (Ops.front() == 0)
|
||||
++NumSpills;
|
||||
else
|
||||
++NumReloads;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue