Trivially re-materializable instructions have spill weights that are half of what it would be otherwise.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35658 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Evan Cheng 2007-04-04 07:04:55 +00:00
parent 776964ac32
commit 710216275b

View File

@ -164,13 +164,13 @@ bool LiveIntervals::runOnMachineFunction(MachineFunction &fn) {
unsigned reg = rep(mop.getReg());
mii->getOperand(i).setReg(reg);
// If the definition instruction is re-materializable, its spill
// weight is zero.
LiveInterval &RegInt = getInterval(reg);
if (!RegInt.remat) {
RegInt.weight +=
(mop.isUse() + mop.isDef()) * pow(10.0F, (int)loopDepth);
}
float w = (mop.isUse()+mop.isDef()) * powf(10.0F, (float)loopDepth);
// If the definition instruction is re-materializable, its spill
// weight is half of what it would have been normally.
if (RegInt.remat)
w /= 2;
RegInt.weight += w;
}
}
++mii;