[llvm] 30b88eb - [LLVM][Intrinsics] Fix `llvm_anyptr_ty` to disallow vector of pointers (#205806)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 08:26:22 PDT 2026


Author: Rahul Joshi
Date: 2026-06-25T08:26:17-07:00
New Revision: 30b88eb862b1fe9aa532ba4501455adb9f02de29

URL: https://github.com/llvm/llvm-project/commit/30b88eb862b1fe9aa532ba4501455adb9f02de29
DIFF: https://github.com/llvm/llvm-project/commit/30b88eb862b1fe9aa532ba4501455adb9f02de29.diff

LOG: [LLVM][Intrinsics] Fix `llvm_anyptr_ty` to disallow vector of pointers (#205806)

`llvm_anyptr_ty` should only allow scalar pointer types and disallow
vector of pointers; fix the vector constraint for `llvm_anyptr_ty`
accordingly. This fixes a regression in `llvm_anyptr_ty` that was
introduced in https://github.com/llvm/llvm-project/pull/203506.

Added a unit test to verify that use of a vector of pointers for
`llvm_anyptr_ty` fails verification.

Added: 
    llvm/test/Verifier/anyptr-bad.ll

Modified: 
    llvm/include/llvm/IR/Intrinsics.td

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/IR/Intrinsics.td b/llvm/include/llvm/IR/Intrinsics.td
index c4eedb62d46fc..129fe08ce3877 100644
--- a/llvm/include/llvm/IR/Intrinsics.td
+++ b/llvm/include/llvm/IR/Intrinsics.td
@@ -584,7 +584,7 @@ def llvm_anyvector_ty  : LLVMAnyType<vAny,
 
 // Note: CodeGenIntrinsics.cpp seems to check this class to check pointers.
 class LLVMAnyPointerType : LLVMAnyType<pAny,
-                                       AnyKindVectorConstraint.None,
+                                       AnyKindVectorConstraint.Scalar,
                                        AnyKindElementConstraint.Pointer>;
 
 def llvm_anyptr_ty     : LLVMAnyPointerType;      // ptr addrspace(N)

diff  --git a/llvm/test/Verifier/anyptr-bad.ll b/llvm/test/Verifier/anyptr-bad.ll
new file mode 100644
index 0000000000000..7f942b39efe48
--- /dev/null
+++ b/llvm/test/Verifier/anyptr-bad.ll
@@ -0,0 +1,11 @@
+; RUN: not opt -passes=verify < %s 2>&1 | FileCheck %s
+
+; CHECK: intrinsic return type (overload type 0) expected any pointer type, but got <2 x ptr>
+; CHECK-NEXT: ptr @llvm.returnaddress
+
+declare <2 x ptr> @llvm.returnaddress(i32)
+
+define void @foo() {
+  call <2 x ptr> @llvm.returnaddress(i32 0)
+  ret void
+}


        


More information about the llvm-commits mailing list