<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/LICM.<wbr>cpp:840<br>
+    if (NewMemDef)<br>
+      MSSAUpdater->insertDef(<wbr>NewMemDef, true);<br>
+    else {<br>
----------------<br>
I'd prefer `/*RenameUses=*/true`.<br></blockquote><div><br></div><div>So, this use renaming is expensive, and i'd like to understand the goal (It requires walking all stores and loads in the dominator subtree rooted at your memory access)</div><div>It's really meant for when you've inserted defs that may alias existing uses.</div><div><br></div><div>As it says:</div><div>"  RenameUses should be set</div><div>   /// to true if the definition may cause new aliases for loads below it.  This</div><div>   /// is not the case for hoisting or sinking or other forms of code *movement*.</div><div><br></div><div><div>   /// It *is* the case for straight code insertion.</div><div>   /// For example:</div><div>   /// store a</div><div>   /// if (foo) { }</div><div>   /// load a</div><div>   ///</div><div>   /// Moving the store into the if block, and calling insertDef, does not</div><div>   /// require RenameUses.</div><div>   /// However, changing it to:</div><div>   /// store a</div><div>   /// if (foo) { store b }</div><div>   /// load a</div><div>   /// Where a mayalias b, *does* require RenameUses be set to true.</div></div><div><br></div><div>If your goal is to replace all uses of  an old memory access with some new memoryaccess, you want to use the replace API :)<br></div><div><br></div><div><br></div></div></div></div>