<div dir="ltr">Dehao mentioned to me that the patch does reorder the operands -- I think this part of the change is wrong -- as it defeats the original purpose of reassociation.<br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 27, 2017 at 4:42 PM, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_4962541503382750299HOEnZb"><div class="m_4962541503382750299h5"><br>
> Maybe?<br>
><br>
> Remember that this reassociate has *zero* global view of expressions.<br>
> It only makes locally good choices.<br>
><br>
> IE given:<br>
>      bar(a + b);<br>
>      bar((a + 2) + b);<br>
><br>
><br>
> This reassociate will process the a + b and a + 2 + b separately,<br>
<br>
</div></div>This patch will not change the original handling of this case because<br>
both a and b has >1 uses.<br>
<div class="m_4962541503382750299HOEnZb"><div class="m_4962541503382750299h5"><br></div></div></blockquote></span><div><br>Sure, i was just pointing out it is only handling local tree-level stuff, and the way it forms trees will not necessarily guarantee that the overall live range of the values is reduced (precisely because the trees it forms do not contain all uses).</div><div><br></div><div>IE it is guaranteed to try to shrink a live range locally, and either succeed or do nothing.</div><div>That may or may not shrink a live range globally, and may increase the live range locally.</div><div><br></div><div><br></div><div>IE</div><div>       A</div><div>        | </div><div>A     |</div><div>|       | </div><div>|       | </div><div>A      A</div><div>       </div><div>A<br>|</div><div>|</div><div>A   </div><div><br></div><div>-></div><div><br></div><div>A<br>|</div><div>|<br>A   A</div><div>      |</div><div>      |</div><div>A   A</div><div>|</div><div>|<br>A</div><div><br></div><div><br></div><div>This has shrunk the live range of A locally, but made it worse globally.</div><div><br></div></div></div></div></blockquote><div><br></div><div><br></div><div><font face="monospace">But at any program point, the max register pressure of the before case is 2, the after case is 1?</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">The placement part of the patch does this</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">before </font></div><div><font face="monospace"><br></font></div><div><font face="monospace, monospace">o1     o2</font></div><div><font face="monospace, monospace"> |      |</font></div><div><font face="monospace, monospace"> |      |   </font></div><div><font face="monospace, monospace"> |      |   o3  o4</font></div><div><font face="monospace, monospace"> |      |    |   |</font></div><div><font face="monospace, monospace"> |      |    |   |    o5   o6</font></div><div><font face="monospace, monospace"> |      |    |   |    |    |</font></div><div><font face="monospace, monospace">    C1       |   |    |    |</font></div><div><font face="monospace, monospace">    |        |   |    |    |</font></div><div><font face="monospace, monospace">    |          C2       C3</font></div><div><font face="monospace, monospace">    |           |        |</font></div><div><font face="monospace, monospace">                I</font></div><div><font face="monospace"><br></font></div><div><font face="monospace">After </font></div><div><font face="monospace"> </font><font face="monospace, monospace">  </font></div><div><font face="monospace, monospace">  o1   o2 </font></div><div><font face="monospace, monospace">   |   |</font></div><div><font face="monospace, monospace">     C1  </font></div><div><font face="monospace, monospace">     |    o3   o4</font></div><div><font face="monospace, monospace">     |     |    |</font></div><div><font face="monospace, monospace">     |       C2    o5    o6</font></div><div><font face="monospace, monospace">     |        |    |      |</font></div><div><font face="monospace, monospace">     |        |       C3</font></div><div><font face="monospace, monospace">     |        |        |</font></div><div><font face="monospace, monospace">     |        |        |</font></div><div><font face="monospace, monospace">     |        |        |</font></div><div><font face="monospace, monospace">              I</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">The max register pressure is reduced from 6 to 4 in this region.</font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">David</font></div></div><br></div></div>