[LLVMdev] Poor register allocation (constants causing spilling)

Robert Lougher rob.lougher at gmail.com
Fri Jul 31 12:03:48 PDT 2015


Hi Quentin,

On 16 July 2015 at 00:22, Robert Lougher <rob.lougher at gmail.com> wrote:
> Hi Quentin,
>
> Sorry for the delay, I've been bogged down with other things today.
>
> On 14 July 2015 at 18:48, Quentin Colombet <qcolombet at apple.com> wrote:
>>>
>>> * A rematerializable interval once split is no longer rematerializable *
>>>
>>> The isRematerializable check in CalcSpillWeights.cpp uses the target
>>> instruction info to check that the machine instruction for the live
>>> interval definition is trivially rematerializable.  In the case of
>>> interval A above, the definition is a load from the constant-pool.
>>> This is trivially rematerializable and the spill weight is halved.
>>> However, in the remainder intervals B, C and D the definition is a
>>> copy.  This is not trivially rematerializable, and the spill weight is
>>> unadjusted.  This means these ranges are considered as expensive as
>>> non-rematerializable ranges.
>>
>> This is the first think to fix. As long as a live-range is rematerializable, we should reflect that properly in the spill weight.
>> Could you clean up your patch to fix that?
>
> Unfortunately my change was an ugly hack that was good enough for my
> experiment but not the right approach for a proper fix (it added an
> is_remat bool to the interval class, and adjusted the weights and
> propagated the flag after local splitting - as they're in the same
> basic block they should remain rematerializable).  I'm now looking at
> a proper fix, although it may take some time...
>

I've posted a cleaned-up version of the patch for review:
http://reviews.llvm.org/D11686

Please let me know what you think.

Thanks,
Rob.



More information about the llvm-dev mailing list