[llvm-dev] Register pressure calculation in the machine scheduler and live-through registers
Jonas Paulsson via llvm-dev
llvm-dev at lists.llvm.org
Mon Sep 11 03:15:29 PDT 2017
On 2017-08-30 23:14, Andrew Trick wrote:
>
>> On Aug 30, 2017, at 1:43 PM, Matthias Braun <matze at braunis.de
>> <mailto:matze at braunis.de>> wrote:
>>
>> That means you cannot use the code from RegisterPressure.{cpp|h} to
>> compute this. The other liveness analysis we have in llvm codegen is
>> LiveIntervals (LiveItnervalAnalysis) which gives you a list of
>> liveness segments of a given vreg (the same representation is used in
>> most linear scan allocators even though LLVM is not using a linear
>> scan approach any more). This representation is not optimized for
>> register pressure queries though: If you want to know how many
>> variables are alive at a certain point in the program you have to
>> check all virtual registers to see whether that point is contained in
>> the liverange of that variable.
>> To make this efficient you probably need some form of precomputation
>> over the whole function.
>
> The code in RegisterPressure.cpp is meant to work with LiveIntervals.
> Those queries only see within a block but are meant to be “seeded”
> with live-through information. That could be done be directly calling
> `addLiveRegs`. Alternately you can record live-through pressure
> separately via `initLiveThru`. It’s just that the MachineScheduler
> does not bother initializing the live-through information.
>
> As Matthias said, actually determining live-through information
> requires a separate global liveness analysis, because LiveIntervals
> doesn’t tell you “what’s live at this point”.
>
> -Andy
Ghassan, have you managed to try this, yet? This seems interesting to me
on SystemZ, as I am still seeing increased spilling when activating
mischeduler for SystemZ and switching to isel source-order scheduling.
/Jonas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170911/01d85805/attachment.html>
More information about the llvm-dev
mailing list