<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Apr 28, 2017 at 11:29 AM, Wei Mi <span dir="ltr"><<a href="mailto:wmi@google.com" target="_blank">wmi@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">When we erase a memory access instruction, existing passes using<br>
memory ssa like GVN, NewGVN, GVNHoist and EarlyCSE uses<br>
MemorySSAUpdater to do the update before the instruction is erased.<br>
<br>
However, if we call llvm::<wbr>RecursivelyDeleteTriviallyDead<wbr>Instructions<br>
to find out dead instruction recursively and memory access<br>
instructions may be erased inside the recursive process, we need a way<br>
to update MemorySSA for those instructions. Note MemorySSA update<br>
should be done before the instruction is erased.<br></blockquote><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Is it acceptable to have an API with MemorySSAUpdater as a param,</blockquote><div><br></div><div>I think so, that is what we do in other APIs.</div><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> or<br>
it is better for MemoryUseOrDef to have a callback value handler to do<br>
the update transparently, </blockquote><div><br></div><div>For removal, the order of removal matters</div><div>Just like with regular IR, you must remove the uses (or ensure a single value for arguments) for MemoryPhi nodes before trying to remove them.</div><div> </div><div>Thus it would likely be easy to cause subtle to trigger bugs with a callback handler.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">or there are better ways to be suggested.<br></blockquote><div> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Thanks,<br>
Wei.<br>
</blockquote></div><br></div></div>