[Mlir-commits] [mlir] [mlir] `remove-dead-values`: properly handle symbol users outside of a pass root. (PR #225355)

Mehdi Amini llvmlistbot at llvm.org
Wed Sep 23 16:07:49 PDT 2026


================
@@ -1050,10 +1050,15 @@ LockedSymbolTableCollection::getSymbolTable(Operation *symbolTableOp) {
 SymbolUserMap::SymbolUserMap(SymbolTableCollection &symbolTable,
                              Operation *symbolTableOp)
     : symbolTable(symbolTable) {
-  // Walk each of the symbol tables looking for discardable callgraph nodes.
+  // Collect symbol users and visibility within each symbol table.
   SmallVector<Operation *> symbols;
   auto walkFn = [&](Operation *symbolTableOp, bool allUsesVisible) {
     for (Operation &nestedOp : symbolTableOp->getRegion(0).getOps()) {
+      if (auto symbol = dyn_cast<SymbolOpInterface>(nestedOp)) {
+        // Private symbols can only have users within this table.
+        if (symbol.isPrivate() || allUsesVisible)
----------------
joker-eph wrote:

Instead of inserting private symbols in the map, can we check if we have a private symbol before querying the map later? 

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


More information about the Mlir-commits mailing list