[Mlir-commits] [mlir] [mlir][SymbolTable] Handle unknown symbol users in SymbolUserMap (PR #227918)

Vinicius Silva llvmlistbot at llvm.org
Mon Oct 5 16:59:16 PDT 2026


================
@@ -1076,6 +1082,12 @@ SymbolUserMap::SymbolUserMap(SymbolTableCollection &symbolTable,
 }
 
 bool SymbolUserMap::areAllUsesVisible(Operation *symbol) const {
+  for (Operation *parent = symbol->getParentOp(); parent;
+       parent = parent->getParentOp()) {
+    if (symbolTablesWithUnknownUsers.contains(parent)) {
+      return false;
+    }
+  }
----------------
viniciusfdasilva wrote:

I agree with you! Well, we can add a safeguard before

 ```cpp 
for (Operation *parent = symbol->getParentOp();...
```

for instance, if (!symbolTablesWithUnknownUsers.isEmpty()). With this guard, we can guarantee that the common cases won't execute this `for` statement. What do you think?

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


More information about the Mlir-commits mailing list