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:
Jakob Stoklund Olesen 2011-09-15 18:22:52 +00:00
parent 2d910ba1e5
commit c94c967656
1 changed files with 7 additions and 1 deletions

View File

@ -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;
}