[llvm] [AMDGPU] Avoid resource propagation for recursion through multiple functions (PR #111004)
Joseph Huber via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 10 09:05:46 PDT 2024
================
@@ -91,13 +91,75 @@ MCSymbol *MCResourceInfo::getMaxSGPRSymbol(MCContext &OutContext) {
return OutContext.getOrCreateSymbol("amdgpu.max_num_sgpr");
}
+// The (partially complete) expression should have no recursion in it. After
+// all, we're trying to avoid recursion using this codepath.
+static bool findSymbolInExpr(MCSymbol *Sym, const MCExpr *Expr,
+ SmallVectorImpl<const MCExpr *> &Exprs,
+ SmallPtrSetImpl<const MCExpr *> &Visited) {
+ // Assert if any of the expressions is already visited (i.e., there is
+ // existing recursion).
+ if (!Visited.insert(Expr).second)
----------------
jhuber6 wrote:
What's the advantage of this over `assert`? Is it because `llvm_unreachable` can be enabled separately?
https://github.com/llvm/llvm-project/pull/111004
More information about the llvm-commits
mailing list