[llvm] [ArgPromotion] Perform alias analysis on actual arguments of Calls (PR #106216)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 24 11:52:42 PDT 2024


================
@@ -716,10 +745,16 @@ static bool findArgParts(Argument *Arg, const DataLayout &DL, AAResults &AAR,
     return true;
 
   // Okay, now we know that the argument is only used by load instructions, and
-  // it is safe to unconditionally perform all of them. Use alias analysis to
-  // check to see if the pointer is guaranteed to not be modified from entry of
-  // the function to each of the load instructions.
+  // it is safe to unconditionally perform all of them.
+
+  // If we can determine that no call to the Function modifies the memory region
+  // accessed through Arg, through alias analysis using actual arguments in the
+  // callers, we know that it is guaranteed to be safe to promote the argument.
+  if (isArgUnmodifiedByAllCalls(Arg, LocationSize::precise(Offset), FAM))
----------------
efriedma-quic wrote:

I'm not sure this is quite right; can an Offset be negative?

https://github.com/llvm/llvm-project/pull/106216


More information about the llvm-commits mailing list