[llvm] r184105 - Switch spill weights from a basic loop depth estimation to BlockFrequencyInfo.

Benjamin Kramer benny.kra at gmail.com
Tue Jun 18 06:35:36 PDT 2013


On 18.06.2013, at 00:14, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:

> 
> On Jun 17, 2013, at 2:47 PM, Jakob Stoklund Olesen <stoklund at 2pi.dk> wrote:
> 
>> This is signed a sum of block frequencies once the normalization is gone. IIRC, my plan was to represent this as two BlockFrequency variables - a negative part and a positive part. That should tame the saturating fixpoint arithmetic in a sensible way.
> 
> In other words, I wanted to do something like this:
> 
>  BlockFrequency BiasN; // Sum of blocks that prefer a spill.
>  BlockFrequency BiasP; // Sum of blocks that prefer a register.
> 
> Then:
> 
> bool update(const Node nodes[]) {
>   // Compute the weighted sum of inputs.
>   BlockFrequency SumN = BiasN;
>   BlockFrequency SumP = BiasP;
>   for (LinkVector::iterator I = Links.begin(), E = Links.end(); I != E; ++I) {
>     if (nodes[I->second].Value == -1)
>       SumN += I->first;
>     if (nodes[I->second].Value == 1)
>       SumP += I->first;
>   }
> 
>   Value = 0;
>   if (SumN > SumP+Thres)
>     Value = -1;
>   if (SumP > SumN+Thres)
>     Value = 1;
> 
> This should safely and symmetrically deal with the saturating block frequency arithmetic, and the result is independent of the order of the link vector.
> 
> It’s possible a simpler solution is just as good.

Attached is a patch set that implements this.

- Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-SpillPlacement-Remove-scaling.-This-is-no-longer-nee.patch
Type: application/octet-stream
Size: 4455 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130618/85e50884/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-SpillPlacement-Remove-floating-point-and-replace-it-.patch
Type: application/octet-stream
Size: 8792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130618/85e50884/attachment-0001.obj>


More information about the llvm-commits mailing list