[llvm] Reapply [AMDGPU] Avoid resource propagation for recursion through multiple functions (PR #112251)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 13 10:19:19 PST 2024
================
@@ -101,25 +101,28 @@ void MCResourceInfo::assignResourceInfoExpr(
const MCConstantExpr *LocalConstExpr =
MCConstantExpr::create(LocalValue, OutContext);
const MCExpr *SymVal = LocalConstExpr;
+ MCSymbol *Sym = getSymbol(FnSym->getName(), RIK, OutContext);
if (!Callees.empty()) {
SmallVector<const MCExpr *, 8> ArgExprs;
- // Avoid recursive symbol assignment.
SmallPtrSet<const Function *, 8> Seen;
ArgExprs.push_back(LocalConstExpr);
- const Function &F = MF.getFunction();
- Seen.insert(&F);
for (const Function *Callee : Callees) {
if (!Seen.insert(Callee).second)
continue;
+
MCSymbol *CalleeFnSym = TM.getSymbol(&Callee->getFunction());
MCSymbol *CalleeValSym =
getSymbol(CalleeFnSym->getName(), RIK, OutContext);
- ArgExprs.push_back(MCSymbolRefExpr::create(CalleeValSym, OutContext));
+ if (!CalleeValSym->isVariable() ||
+ !CalleeValSym->getVariableValue(/*isUsed=*/false)
----------------
arsenm wrote:
Comment that you need to avoid introducing a recursive expression
https://github.com/llvm/llvm-project/pull/112251
More information about the llvm-commits
mailing list