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

via llvm-commits llvm-commits at lists.llvm.org
Sun May 26 08:53:47 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;
+
----------------
goldsteinn wrote:

I guess I feel like we will inevitably hit a case where we **do** want to propagate an attr to byval, and that point, this code will become alot more complex. Although I guess the other hand is having the list out each attr to cross out with byval is also fairly complex.

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


More information about the llvm-commits mailing list