[llvm] [AMDGPU][Verifier] Mark calls to entry functions as invalid in the IR verifier (PR #134910)

Shilei Tian via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 9 20:58:04 PDT 2025


================
@@ -290,6 +290,26 @@ namespace CallingConv {
 
 } // end namespace CallingConv
 
+/// \return true if the calling convention allows the function to be called
+/// directly or indirectly via a call-like instruction.
+constexpr bool isCallableCC(CallingConv::ID CC) {
+  switch (CC) {
+  case CallingConv::AMDGPU_CS_Chain:
+  case CallingConv::AMDGPU_CS_ChainPreserve:
+  case CallingConv::AMDGPU_CS:
+  case CallingConv::AMDGPU_ES:
+  case CallingConv::AMDGPU_GS:
+  case CallingConv::AMDGPU_HS:
+  case CallingConv::AMDGPU_KERNEL:
+  case CallingConv::AMDGPU_LS:
+  case CallingConv::AMDGPU_PS:
+  case CallingConv::AMDGPU_VS:
+    return false;
----------------
shiltian wrote:

There are "valid" test case calling to SPIR-V kernel directly. I thought that is allowed by the SPIR-V spec?

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


More information about the llvm-commits mailing list