<div dir="ltr">Yeah, i was about to say, you can make this cycle as large as you want.<div>It may be that instcombine doesn't happen to match that pattern now, but in general, it has to have a fixpoint where it says "yeah, this is the right form" or else you are always prone to infinite loops with phi cycles.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 3, 2016 at 12:34 PM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">majnemer added inline comments.<br>
<br>
================<br>
Comment at: lib/Transforms/InstCombine/InstCombineCasts.cpp:1816-1825<br>
@@ +1815,12 @@<br>
<span class="">+ bool Store = false;<br>
+ for (User *U : PN->users()) {<br>
+ auto *SI = dyn_cast<StoreInst>(U);<br>
+ if (SI && SI->isSimple() && SI->getOperand(0) == PN)<br>
+ Store = true;<br>
+ }<br>
+ for (User *U : CI.users()) {<br>
+ auto *SI = dyn_cast<StoreInst>(U);<br>
+ if (SI && SI->isSimple() && SI->getOperand(0) == &CI && Store)<br>
+ return nullptr;<br>
+ }<br>
+<br>
</span>----------------<br>
Could a problem arise if this phi was used by a phi?<br>
<div class="HOEnZb"><div class="h5"><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>
</div></div></blockquote></div><br></div>