[llvm] [Inliner] Don't propagate memory attributes to byval params (PR #93381)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun May 26 07:37:42 PDT 2024


================
@@ -1389,6 +1389,12 @@ static void AddParamAndFnBasicAttributes(const CallBase &CB,
         if (!Arg)
           continue;
 
+        if (AL.hasParamAttr(I, Attribute::ByVal))
+          // It's unsound to propagate memory attributes to byval arguments.
+          // Even if CalledFunction doesn't e.g. write to the argument,
+          // the call to NewInnerCB may write to its by-value copy.
+          continue;
+
----------------
nikic wrote:

I think skipping byval in generaly makes sense. E.g. we also wouldn't want to propagate align or dereferenceable to it.

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


More information about the llvm-commits mailing list