<div dir="ltr">So why does it loop more than once?<div>Does it not fixpoint at the second form?</div><div>If not that seems like the issue.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 31, 2016 at 8:34 PM, Evgeny Stupachenko via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@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">evstupac added a comment.<br>
<span class=""><br>
> Also, I find removing things from the worklist incredibly, deeply suspicious. Otherwise the rest of InstCombine must be careful not to add the item to the list, no?<br>
<br>
<br>
</span>Here InstCombine creates exactly the thing it is searching for: new BitCast (lines 1876, 1898) and new PHI (line 1861).<br>
<span class=""><br>
> Could you please explain how this ends up looping? Are we recreating the same input over again?<br>
<br>
<br>
</span>I'll try to narrow my case and add a test case.<br>
Basically what can occur is:<br>
<br>
  xB = load (type B);<br>
  xA = load (type A);<br>
  yB = (B)xA;           // A -> B<br>
  zB = PHI[xB, yB];     // PHI<br>
  zA = (A)zB;           // B -> A<br>
  store zA;<br>
  store zB;<br>
<br>
The transformation will create (new instruction marked with +):<br>
<br>
  xB = load (type B);<br>
  xA = load (type A);<br>
  +yA = (A)xB;             // B -> A<br>
  +zAn = PHI[yA, xA];      // PHI<br>
  +zBn = (B)zAn;           // A -> B<br>
  store zAn;<br>
  store zBn;<br>
<span class="im HOEnZb"><br>
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="http://reviews.llvm.org/D20847" rel="noreferrer" target="_blank">http://reviews.llvm.org/D20847</a><br>
<br>
<br>
<br>
</span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div>