[llvm] [AMDGPU] Remove calling conv check on entry function (PR #162080)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 6 05:48:48 PDT 2025


https://github.com/jofrn created https://github.com/llvm/llvm-project/pull/162080

It is undefined behavior to call a function with a mismatched calling convention. Rather than crash on this behavior, it should compile.

>From a0f0b23893fea1edd52a515c5d9a3d7326efec35 Mon Sep 17 00:00:00 2001
From: jofrn <jofernau at amd.com>
Date: Mon, 6 Oct 2025 08:42:09 -0400
Subject: [PATCH] [AMDGPU] Remove calling conv check on entry function

It is undefined behavior to call a function with a
mismatched calling convention. Rather than crash on
this behavior, it should compile.
---
 llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
index 8101c68986241..2c1729f107321 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -256,13 +256,6 @@ AMDGPUResourceUsageAnalysisImpl::analyzeResourceUsage(
 
         const Function *Callee = getCalleeFunction(*CalleeOp);
 
-        // Avoid crashing on undefined behavior with an illegal call to a
-        // kernel. If a callsite's calling convention doesn't match the
-        // function's, it's undefined behavior. If the callsite calling
-        // convention does match, that would have errored earlier.
-        if (Callee && AMDGPU::isEntryFunctionCC(Callee->getCallingConv()))
-          report_fatal_error("invalid call to entry function");
-
         auto isSameFunction = [](const MachineFunction &MF, const Function *F) {
           return F == &MF.getFunction();
         };



More information about the llvm-commits mailing list