[llvm] [Inliner] Prevent adding pointer attributes to non-pointer arguments (PR #115569)

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 8 22:30:23 PST 2024


================
@@ -1477,6 +1477,15 @@ static void AddParamAndFnBasicAttributes(const CallBase &CB,
 
         // If so, propagate its access attributes.
         AL = AL.addParamAttributes(Context, I, ValidObjParamAttrs[ArgNo]);
+
+        // If the argument is not a pointer type, remove attributes which only
+        // apply to pointer types.
+        if (!NewInnerCB->getArgOperand(I)->getType()->isPointerTy()) {
+          AL = AL.removeParamAttribute(Context, I, Attribute::ReadNone);
+          AL = AL.removeParamAttribute(Context, I, Attribute::ReadOnly);
----------------
goldsteinn wrote:

writeonly too probably.

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


More information about the llvm-commits mailing list