<div dir="ltr">In particular, if you want to add support, the right way to know what to rename is (off the top of my head)<div><br></div><div>add a flag or something to have renamepass reset all uses it sees (you only have to change the uses, defs are all linked together and thus already fixed by the updater). Right now it only does that if they have no defining access.</div><div><br></div><div>Make it skip blocks already in the visited set (the incomingval to pass to successors is the existing incoming val if getDefsList.rbegin() == getDefsList.rend(), and getDefsList.rbegin() otherwise) to prevent duplicate work from the below:</div><div><br></div><div>Now:</div><div> call renamepass on the bb for the inserted def, using the defining access of the first def as the incoming val.</div><div>call renamepass on the bb of each inserted phi (you can use a null incoming val since incoming val will become the phi)</div><div><br></div><div>This should rename all of the affected uses.</div><div><br></div><div> <br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Feb 17, 2017 at 1:37 PM, Daniel Berlin <span dir="ltr"><<a href="mailto:dberlin@dberlin.org" target="_blank">dberlin@dberlin.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Fri, Feb 17, 2017 at 1:19 PM, Piotr Padlewski <span dir="ltr"><<a href="mailto:piotr.padlewski@gmail.com" target="_blank">piotr.padlewski@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi guys,<div>a question about updating memory SSA:</div><div>Is it expected that e.g insertion of MemoryDef doesn't change all dominated uses?</div></div></blockquote></span><div>At the moment, it is expected you are essentially just hoisting/sinking them, not actually changing the aliasing.</div><div>The test does not obviously test this constraint, and is pretty contrived.</div><div>If you have a use case where we need to rename affected uses, i'm happy to make it do that, it's trivial.</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>For example test case CreateLoadsAndStoreUpdate<wbr>r produces:</div><div><br></div><div><div>define void @F(i8*) {</div><div>; 1 = MemoryDef(liveOnEntry)</div><div> store i8 16, i8* %0</div><div>; 4 = MemoryDef(1)</div><div> store i8 16, i8* %0</div><div> br i1 true, label %2, label %3</div><div><br></div><div>; <label>:2: ; preds = %1</div><div>; 2 = MemoryDef(4)</div><div> store i8 16, i8* %0</div><div> br label %4</div><div><br></div><div>; <label>:3: ; preds = %1</div><div> br label %4</div><div><br></div><div>; <label>:4: ; preds = %3, %2</div><div>; 3 = MemoryPhi({%3,4},{%2,2})</div><div>; MemoryUse(3)</div><div> %5 = load i8, i8* %0</div><div>; MemoryUse(1)</div><div> %6 = load i8, i8* %0</div><div>}</div></div><div><br></div><div>What is the general behavior that I can expect when I insert or remove def/use?</div></div></blockquote><div><br></div></span><div>So far, it is built to replace all the hoist/sink/removal/etc cases.</div><div>It should work for all of those cases.</div><div><br></div><div>For use insertion, it will always be correct.</div><div>For stores, It will even work if you sink a store to a branch.</div><div>It will produce wrong results if you insert new stores in the way of old stores.</div><span class=""><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Another general question: what is the use of MemorySSAUpdater? </div></div></blockquote><div><br></div></span><div>To replace hand-written broken updating.</div><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>When should I use updater and when the MemorySSA API is sufficient? </div></div></blockquote><div><br></div></span><div>Unless you are just removing accesses, you should use the Updater.</div><div><br></div><div>Due to the single-variable nature of memoryssa, there are tricky cases that need to be handled.</div><div><br></div></div></div></div>
</blockquote></div><br></div>