[llvm] Fix SIFixSGPRCopies To Handle Physical Registers (PR #149859)
Janek van Oirschot via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 23 04:13:04 PDT 2025
================
@@ -256,17 +256,18 @@ AMDGPUResourceUsageAnalysisImpl::analyzeResourceUsage(
const Function *Callee = getCalleeFunction(*CalleeOp);
+ auto isSameFunction = [](const MachineFunction &MF, const Function *F) {
+ return F == &MF.getFunction();
+ };
+
// 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()))
+ if (Callee && AMDGPU::isEntryFunctionCC(Callee->getCallingConv()) &&
+ !isSameFunction(MF, Callee))
report_fatal_error("invalid call to entry function");
----------------
JanekvO wrote:
AFAIU, the `isEntryFunctionCC`-ness of this is the blocker on why it cannot be a callee, regardless of (self-)recursion. Recursion itself is possible (albeit dubious in terms of resource allocation and runtime use, but I digress) so long as it isn't marked as an entry function.
https://github.com/llvm/llvm-project/pull/149859
More information about the llvm-commits
mailing list