[llvm] [AMDGPU] Avoid resource propagation for recursion through multiple functions (PR #111004)

Janek van Oirschot via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 7 06:15:09 PDT 2024


================
@@ -110,11 +163,18 @@ void MCResourceInfo::assignResourceInfoExpr(
       if (!Seen.insert(Callee).second)
         continue;
       MCSymbol *CalleeValSym = getSymbol(Callee->getName(), RIK, OutContext);
-      ArgExprs.push_back(MCSymbolRefExpr::create(CalleeValSym, OutContext));
+      if (CalleeValSym->isVariable()) {
+        if (!foundRecursiveSymbolDef(
+                Sym, CalleeValSym->getVariableValue(/*isUsed=*/false))) {
+          ArgExprs.push_back(MCSymbolRefExpr::create(CalleeValSym, OutContext));
+        }
----------------
JanekvO wrote:

I may not understand what's suggested with a visited set but I've attempted a visit set using the `Seen` set above but that can't consider the case where there's multi function recursion since only single-level callees are being covered by `Seen`. If using a visit set with walking over the expression, it may return true with cases where a caller isn't on the recursive path where I'd like to find cases where the currently assigned Function's symbol is somewhere in the uses of its callees.

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


More information about the llvm-commits mailing list