Skip to content

Conversation

jofrn
Copy link
Contributor

@jofrn jofrn commented Oct 6, 2025

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

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

llvmbot commented Oct 6, 2025

@llvm/pr-subscribers-backend-amdgpu

Author: None (jofrn)

Changes

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 --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();
         };

Copy link
Contributor

@arsenm arsenm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs test

@CatherineMoore
Copy link
Contributor

@CatherineMoore for awareness

@jofrn jofrn force-pushed the users/jofrn/cc.entry-fn branch from 988f6de to 2f3d478 Compare October 13, 2025 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants