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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-amdgpu

Author: None (jofrn)

<details>
<summary>Changes</summary>

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

---
Full diff: https://github.com/llvm/llvm-project/pull/162080.diff


1 Files Affected:

- (modified) llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp (-7) 


``````````diff
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
index 0ea9add891111..b03d50f2d451d 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUResourceUsageAnalysis.cpp
@@ -261,13 +261,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();
         };

``````````

</details>


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


More information about the llvm-commits mailing list