<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 2017-08-30 23:14, Andrew Trick
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:78C3A9AD-8765-4AC7-90FB-2B8097F4B384@apple.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On Aug 30, 2017, at 1:43 PM, Matthias Braun <<a
href="mailto:matze@braunis.de" class=""
moz-do-not-send="true">matze@braunis.de</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px;" class="">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.</div>
<div style="font-family: Helvetica; font-size: 12px;
font-style: normal; font-variant-caps: normal;
font-weight: normal; letter-spacing: normal; text-align:
start; text-indent: 0px; text-transform: none;
white-space: normal; word-spacing: 0px;
-webkit-text-stroke-width: 0px;" class="">To make this
efficient you probably need some form of precomputation
over the whole function.</div>
</div>
</blockquote>
</div>
<br class="">
<div class="">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.</div>
<div class=""><br class="">
</div>
<div class="">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”.</div>
<div class=""><br class="">
</div>
<div class="">-Andy</div>
</blockquote>
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. <br>
<br>
/Jonas<br>
</body>
</html>