<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">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><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><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 <wbr>CreateLoadsAndStoreUpdater 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><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><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><div>To replace hand-written broken updating.</div><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><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>