<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 23, 2017 at 8:38 AM, Godala, Bhargav-reddy via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">
Hi,
<div><br>
</div>
<div>Can some one explain the intended behaviour of following loop in void MemorySSAUpdater::insertDef(Me<wbr>moryDef *MD, bool RenameUses) function.</div>
<div><br>
</div>
<div>
<div><font face="Menlo"> while (!FixupList.empty()) {</font></div>
<div><font face="Menlo"> unsigned StartingPHISize = InsertedPHIs.size();</font></div>
<div><font face="Menlo"> fixupDefs(FixupList);</font></div>
<div><font face="Menlo"> FixupList.clear();</font></div>
<div><font face="Menlo"> // Put any new phis on the fixup list, and process them</font></div>
<div><font face="Menlo"> FixupList.append(InsertedPHIs.<wbr>end() - StartingPHISize, InsertedPHIs.end());</font></div>
<div><font face="Menlo"> }</font></div>
<div><br>
</div>
<div>With the latest code on trunk compilation of perlbench SPEC CPU 2017 INT benchmark with “-O3 -inline-threshold=1000 and -enable-gvn-hoist” options is looping infinitely on the above loop.</div></div></div></blockquote><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div>
<div><br>
</div>
<div>Above loop never terminates unless elements from InsertedPHIs are removed as and when they are processed.</div></div></div></blockquote><div><br></div><div>Yes, the loop is slightly off.</div><div><br></div><div>The intention is to process any new phis added by fixupdefs.</div><div>However, it really should be InsertedPHIs.start() + StartingPHISize.</div><div>That will insert only the phis that fixupdefs added, and it will terminate as soon as fixupdefs stops adding phis.</div><div> </div></div></div></div>