[PATCH] D40375: Use MemorySSA in LICM to do sinking and hoisting.

Daniel Berlin via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 21 17:40:12 PST 2017

> ================
> Comment at: lib/Transforms/Scalar/LICM.cpp:840
> +    if (NewMemDef)
> +      MSSAUpdater->insertDef(NewMemDef, true);
> +    else {
> ----------------
> I'd prefer `/*RenameUses=*/true`.

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)
It's really meant for when you've inserted defs that may alias existing

As it says:
"  RenameUses should be set
   /// to true if the definition may cause new aliases for loads below it.
   /// is not the case for hoisting or sinking or other forms of code

   /// It *is* the case for straight code insertion.
   /// For example:
   /// store a
   /// if (foo) { }
   /// load a
   /// Moving the store into the if block, and calling insertDef, does not
   /// require RenameUses.
   /// However, changing it to:
   /// store a
   /// if (foo) { store b }
   /// load a
   /// Where a mayalias b, *does* require RenameUses be set to true.

If your goal is to replace all uses of  an old memory access with some new
memoryaccess, you want to use the replace API :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171221/6d6b47a4/attachment.html>

More information about the llvm-commits mailing list