[llvm] Reapply [AMDGPU] Avoid resource propagation for recursion through multiple functions (PR #112251)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 5 22:53:22 PDT 2025
MaskRay wrote:
The `isSymbolUsedInExpression` use within `parseAssignmentExpression` is a hack and should not be used externally.
```
if (Sym) {
// Diagnose assignment to a label.
//
// FIXME: Diagnostics. Note the location of the definition as a label.
// FIXME: Diagnose assignment to protected identifier (e.g., register name).
if (Value->isSymbolUsedInExpression(Sym))
return Parser.Error(EqualLoc, "Recursive use of '" + Name + "'");
else if (Sym->isUndefined(/*SetUsed*/ false) && !Sym->isUsed() &&
!Sym->isVariable())
; // Allow redefinitions of undefined symbols only used in directives.
else if (Sym->isVariable() && !Sym->isUsed() && allow_redef)
; // Allow redefinitions of variables that haven't yet been used.
else if (!Sym->isUndefined() && (!Sym->isVariable() || !allow_redef))
return Parser.Error(EqualLoc, "redefinition of '" + Name + "'");
else if (!Sym->isVariable())
return Parser.Error(EqualLoc, "invalid assignment to '" + Name + "'");
else if (!isa<MCConstantExpr>(Sym->getVariableValue()))
return Parser.Error(EqualLoc,
"invalid reassignment of non-absolute variable '" +
Name + "'");
} else if (Name == ".") {
```
If I ever have time to clean it, I think the traversal should be moved to AMDGPU.
https://github.com/llvm/llvm-project/pull/112251
More information about the llvm-commits
mailing list