[llvm] Fix SIFixSGPRCopies To Handle Physical Registers (PR #149859)

Patrick Simmons via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 22 09:26:26 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");
----------------
linuxrocks123 wrote:

The added testcase, from a fuzzer, uses self-recursion.  If that's not allowed, please let me know so the fuzzer can be updated.

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


More information about the llvm-commits mailing list