[llvm] [llubi] Add support for byval pointer arguments (PR #201852)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 8 09:51:05 PDT 2026
================
@@ -1826,10 +1830,61 @@ class InstExecutor : public InstVisitor<InstExecutor, void>,
for (auto [I, Arg] : enumerate(CB.args())) {
Type *ArgTy = Arg->getType();
AnyValue &ArgVal = CalleeArgs[I];
+
// CallBase::paramHasAttr also checks parameter attributes at known
// callee. We do it explicitly to avoid duplication.
AttributeSet AttrsAtCallSite = CB.getParamAttributes(I);
AttributeSet AttrsAtCallee = Callee->getAttributes().getParamAttrs(I);
+
+ if (ArgTy->isPointerTy()) {
+ auto *ByValTy = AttrsAtCallSite.getByValType();
+ auto *ByValTyFromCallee = AttrsAtCallee.getByValType();
+ if (ByValTy != ByValTyFromCallee) {
+ reportImmediateUB()
+ << "Mismatched byval attribute between callee and callsite.";
+ return;
+ }
+ if (ByValTy) {
+ if (ArgVal.isPoison()) {
----------------
dtcxzyw wrote:
Yes. I added a test.
https://github.com/llvm/llvm-project/pull/201852
More information about the llvm-commits
mailing list