diff options
author | Harald van Dijk <harald.vandijk@codeplay.com> | 2024-11-09 16:17:16 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-09 16:17:16 +0000 |
commit | ccaded2b1d0d2cf3d8041baeeec9cfad632c9450 (patch) | |
tree | 3cbf56a8fdbd8fd0e0d1d6b92fd3dea9a988a82f /llvm/lib/Transforms/Utils/InlineFunction.cpp | |
parent | 958e37cd1feabf29fb1cc3fb5ac82051ad8d43eb (diff) | |
download | llvm-ccaded2b1d0d2cf3d8041baeeec9cfad632c9450.zip llvm-ccaded2b1d0d2cf3d8041baeeec9cfad632c9450.tar.gz llvm-ccaded2b1d0d2cf3d8041baeeec9cfad632c9450.tar.bz2 |
[Inliner] Prevent adding pointer attributes to non-pointer arguments (#115569)
Fixes a crash seen after #114311
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/InlineFunction.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index a27cb4d..aa5e04d 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -1465,7 +1465,7 @@ static void AddParamAndFnBasicAttributes(const CallBase &CB, } } AL = AL.addParamAttributes(Context, I, NewAB); - } else { + } else if (NewInnerCB->getArgOperand(I)->getType()->isPointerTy()) { // Check if the underlying value for the parameter is an argument. const Value *UnderlyingV = getUnderlyingObject(InnerCB->getArgOperand(I)); @@ -1473,10 +1473,13 @@ static void AddParamAndFnBasicAttributes(const CallBase &CB, if (!Arg) continue; ArgNo = Arg->getArgNo(); + } else { + continue; } // If so, propagate its access attributes. AL = AL.addParamAttributes(Context, I, ValidObjParamAttrs[ArgNo]); + // We can have conflicting attributes from the inner callsite and // to-be-inlined callsite. In that case, choose the most // restrictive. |