[Mlir-commits] [mlir] [mlir] Use getAttr to replace getInherentAttr in the test-symbol-uses pass (PR #172675)
lonely eagle
llvmlistbot at llvm.org
Wed Dec 17 07:37:49 PST 2025
================
@@ -59,7 +59,7 @@ struct SymbolUsesPass
symbolUse.getUser()->getParentOp(), symbolUse.getSymbolRef())) {
symbolUse.getUser()->emitRemark()
<< "found use of symbol : " << symbolUse.getSymbolRef() << " : "
- << *symbol->getInherentAttr(SymbolTable::getSymbolAttrName());
+ << symbol->getAttr(SymbolTable::getSymbolAttrName());
----------------
linuxlonelyeagle wrote:
> Seems like the "launch_func" is the culprit, it does not seem to be defined as `SymbolUserOpInterface`, so I'm not even sure why it is visited at all. We seem to have some inconsistency here.
When walking to "gpu.func", the "symbol" (follow variable) is "gpu.func", we use `SymbolTable::getSymbolUses(symbol, &module.getBodyRegion()); ` to visit the "launch_func"
```
symbolUses = SymbolTable::getSymbolUses(symbol, &module.getBodyRegion());
assert(symbolUses && "expected no unknown operations");
for (SymbolTable::SymbolUse symbolUse : *symbolUses) {
// Check that we can resolve back to our symbol.
if (SymbolTable::lookupNearestSymbolFrom(
symbolUse.getUser()->getParentOp(), symbolUse.getSymbolRef())) {
symbolUse.getUser()->emitRemark()
<< "found use of symbol : " << symbolUse.getSymbolRef() << " : "
<< symbol->getAttr(SymbolTable::getSymbolAttrName());
}
}
```
https://github.com/llvm/llvm-project/pull/172675
More information about the Mlir-commits
mailing list