<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
================<br>
Comment at: lib/Transforms/Scalar/GVNSink.<wbr>cpp:664<br>
@@ +663,3 @@<br>
+<br>
+    // FIXME: I'm certain this MemorySSA update code is wrong, but not sure<br>
+    // how to fix it.<br>
----------------<br>
I'll have a look.<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br></div></div></blockquote><div><br></div><div>Among other things, note that we build pruned memoryssa form.</div><div><br></div><div>This means if you have</div><div><br></div><div>if ()</div><div>{<br>  memorydef</div><div>  memoryuse </div><div>}</div><div>else {</div><div>  memorydef</div><div>  memoryuse</div><div>}</div><div><no memoryuse><br></div><div><br></div><div>we will not place a phi below the if statement.</div><div><br></div><div>This basically means any pass that does sinking may have to create phis if they don't exist.</div><div><br></div><div>If you delete</div><div>IDFs.setLiveInBlocks(LiveInBlocks);  in MemorySSA.cpp</div><div><br></div><div>you should be guaranteed that the MemoryPhi's you need for sinking should already exist, and it should be a matter of just the right move and replacement steps.</div><div><br></div><div>I'm pretty convinced at this point it's not worth saving a small number of unused MemoryPhis to make updating more complicated for all users.</div><div><br></div><div>So if you want to send a patch to delete that line in MemorySSA (and update/remove the one test that tests it), i'll LGTM.</div><div><br></div><div><br></div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">
<br>
Repository:<br>
  rL LLVM<br>
<br>
<a href="https://reviews.llvm.org/D24805" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D24805</a><br>
<br>
<br>
<br>
</div></div></blockquote></div><br></div></div>