<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<br class="">
<div class="">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">
With regards<br class="">
Bhargav Reddy Godala<br class="">
Software Engineer 2<br class="">
Bangalore, India<br class="">
E-mail: <a href="mailto:Bhargav-reddy.Godala@amd.com" class="">Bhargav-reddy.Godala@amd.com</a> Ext 30678</div>
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" class="">
<br class="">
</div>
<br class="Apple-interchange-newline">
</div>
<br class="">
<div>
<blockquote type="cite" class="">
<div class="">On 23-Sep-2017, at 9:27 PM, Daniel Berlin <<a href="mailto:dberlin@dberlin.org" class="">dberlin@dberlin.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class=""><br class="">
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Sat, Sep 23, 2017 at 8:38 AM, Godala, Bhargav-reddy via llvm-dev
<span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="">Hi,
<div class=""><br class="">
</div>
<div class="">Can some one explain the intended behaviour of following loop in void MemorySSAUpdater::insertDef(Me<wbr class="">moryDef *MD, bool RenameUses) function.</div>
<div class=""><br class="">
</div>
<div class="">
<div class=""><font face="Menlo" class=""> while (!FixupList.empty()) {</font></div>
<div class=""><font face="Menlo" class=""> unsigned StartingPHISize = InsertedPHIs.size();</font></div>
<div class=""><font face="Menlo" class=""> fixupDefs(FixupList);</font></div>
<div class=""><font face="Menlo" class=""> FixupList.clear();</font></div>
<div class=""><font face="Menlo" class=""> // Put any new phis on the fixup list, and process them</font></div>
<div class=""><font face="Menlo" class=""> FixupList.append(InsertedPHIs.<wbr class="">end() - StartingPHISize, InsertedPHIs.end());</font></div>
<div class=""><font face="Menlo" class=""> }</font></div>
<div class=""><br class="">
</div>
<div class="">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 class=""><br class="">
</div>
<div class=""> <br class="">
</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" class="">
<div class="">
<div class=""><br class="">
</div>
<div class="">Above loop never terminates unless elements from InsertedPHIs are removed as and when they are processed.</div>
</div>
</div>
</blockquote>
<div class=""><br class="">
</div>
<div class="">Yes, the loop is slightly off.</div>
</div>
</div>
</div>
</div>
</blockquote>
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class="gmail_extra">
<div class="gmail_quote">
<div class=""><br class="">
</div>
<div class="">The intention is to process any new phis added by fixupdefs.</div>
<div class="">However, it really should be InsertedPHIs.start() + StartingPHISize.</div>
</div>
</div>
</div>
</div>
</blockquote>
<div><br class="">
</div>
Even in that case it still is infinite, as there is no call to clear already processed elements(MemoryPhi) in InsertedPHIs. fixupDefs function only inserts new elements but not remove any that are processed.<br class="">
<blockquote type="cite" class="">
<div class="">
<div dir="ltr" class="">
<div class="gmail_extra">
<div class="gmail_quote">
<div class="">That will insert only the phis that fixupdefs added, and it will terminate as soon as fixupdefs stops adding phis.</div>
<div class=""> </div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
<br class="">
</body>
</html>