[PATCH] D156409: [AMDGPU] More verifier checks for llvm.amdgcn.cs.chain

Diana Picus via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 00:37:34 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG5a8ecd6456c8: [AMDGPU] More verifier checks for llvm.amdgcn.cs.chain (authored by rovka).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156409/new/

https://reviews.llvm.org/D156409

Files:
  llvm/lib/IR/Verifier.cpp
  llvm/test/Verifier/AMDGPU/intrinsic-amdgpu-cs-chain.ll


Index: llvm/test/Verifier/AMDGPU/intrinsic-amdgpu-cs-chain.ll
===================================================================
--- llvm/test/Verifier/AMDGPU/intrinsic-amdgpu-cs-chain.ll
+++ llvm/test/Verifier/AMDGPU/intrinsic-amdgpu-cs-chain.ll
@@ -10,6 +10,20 @@
   unreachable
 }
 
+define amdgpu_cs_chain void @bad_vgpr_args(ptr %fn, i32 %exec, <4 x i32> inreg %sgpr, { ptr, <3 x i32> } inreg %vgpr) {
+  ; CHECK: VGPR arguments must not have the `inreg` attribute
+  ; CHECK-NEXT: @llvm.amdgcn.cs.chain
+  call void(ptr, i32, <4 x i32>, { ptr, <3 x i32> }, i32, ...) @llvm.amdgcn.cs.chain(ptr %fn, i32 %exec, <4 x i32> inreg %sgpr, { ptr, <3 x i32> } inreg %vgpr, i32 0)
+  unreachable
+}
+
+define amdgpu_cs_chain void @bad_sgpr_args(ptr %fn, i32 %exec, <4 x i32> %sgpr, { ptr, <3 x i32> } %vgpr) {
+  ; CHECK: SGPR arguments must have the `inreg` attribute
+  ; CHECK-NEXT: @llvm.amdgcn.cs.chain
+  call void(ptr, i32, <4 x i32>, { ptr, <3 x i32> }, i32, ...) @llvm.amdgcn.cs.chain(ptr %fn, i32 %exec, <4 x i32> %sgpr, { ptr, <3 x i32> } %vgpr, i32 0)
+  unreachable
+}
+
 define amdgpu_cs_chain void @bad_exec(ptr %fn, i32 %exec, <4 x i32> inreg %sgpr, { ptr, <3 x i32> } %vgpr, i32 %flags) {
   ; CHECK: Intrinsic called with incompatible signature
   ; CHECK-NEXT: @llvm.amdgcn.cs.chain
Index: llvm/lib/IR/Verifier.cpp
===================================================================
--- llvm/lib/IR/Verifier.cpp
+++ llvm/lib/IR/Verifier.cpp
@@ -5919,6 +5919,11 @@
                   &Call);
       break;
     }
+
+    Check(Call.paramHasAttr(2, Attribute::InReg),
+          "SGPR arguments must have the `inreg` attribute", &Call);
+    Check(!Call.paramHasAttr(3, Attribute::InReg),
+          "VGPR arguments must not have the `inreg` attribute", &Call);
     break;
   }
   case Intrinsic::experimental_convergence_entry:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156409.551029.patch
Type: text/x-patch
Size: 1843 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230817/92cf38dc/attachment.bin>


More information about the llvm-commits mailing list