[llvm-commits] CVS: llvm/lib/CodeGen/LiveIntervalAnalysis.cpp RegAllocLinearScan.cpp VirtRegMap.cpp VirtRegMap.h
Evan Cheng
evan.cheng at apple.com
Fri Mar 30 15:34:30 PDT 2007
On Mar 30, 2007, at 3:09 PM, Chris Lattner wrote:
>
> On Mar 30, 2007, at 3:03 PM, Evan Cheng wrote:
>
>>>> 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);
>>>> - RegInt.weight +=
>>>> - (mop.isUse() + mop.isDef()) * pow(10.0F, (int)
>>>> loopDepth);
>>>> + if (!RegInt.remat) {
>>>> + RegInt.weight +=
>>>> + (mop.isUse() + mop.isDef()) * pow(10.0F, (int)
>>>> loopDepth);
>>>> + }
>>>
>>> Should it really be zero? It should definitely be lower that a
>>> normal value, but zero seems low. The loop depth should still be
>>> taken into consideration.
>>
>> Funny you should mention this. I am re-evaluating this right now.
>> My thinking is loads (load from constantpool or stack slots) would
>> have the normal weight. The rest will have half the weight.
>
> Why not just make everything half weight? What would be lost?
To avoid a common problem. A value live-in to a function and is
loaded from stack slot and used in a loop. You do not want to
rematerialize this and end up issuing the load in the loop.
This is tricky to get right. I am not sure simple heuristics can
cover all the cases.
Evan
>
> -Chris
More information about the llvm-commits
mailing list