[llvm] IR/Verifier: Do not allow kernel to kernel calls. (PR #144445)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 23 07:56:59 PDT 2025
================
@@ -0,0 +1,9 @@
+; RUN: not llvm-as %s -disable-output 2>&1 | FileCheck %s
+
+define amdgpu_kernel void @kernel(ptr addrspace(1) %out, i32 %n) {
+entry:
+; CHECK: calling convention does not permit calls
+; CHECK-NEXT: call void @kernel(ptr addrspace(1) %out, i32 %n)
+ call void @kernel(ptr addrspace(1) %out, i32 %n)
----------------
arsenm wrote:
> Wouldn't this rely on Codegen retrieving the CC from the module as well?
Not sure what you mean by this, but no. The calling convention is always known at the callsite and is absolute. The fact that the call target happens to be uncallable doesn't matter for the purposes of the call. The resource analysis looking for call sites should just ignore this call, it isn't real. It's impossible and can be treated as unreachable code
https://github.com/llvm/llvm-project/pull/144445
More information about the llvm-commits
mailing list