[Mlir-commits] [mlir] [mlir][RemoveDeadValues] Use `SymbolUserMap` to avoid quadratic symbol lookups (PR #205448)

Mehdi Amini llvmlistbot at llvm.org
Wed Jul 1 07:19:24 PDT 2026


================
@@ -770,6 +766,13 @@ void RemoveDeadValues::runOnOperation() {
   auto &la = getAnalysis<RunLivenessAnalysis>();
   Operation *module = getOperation();
 
+  // Build a symbol user map once up front so that processFuncOp can look up the
+  // callers of each function in O(1). Otherwise, each call would walk the
+  // entire module to find the callers, making the pass O(numFunctions *
+  // numOperations).
+  SymbolTableCollection symbolTableCollection;
+  SymbolUserMap symbolUserMap(symbolTableCollection, module);
+
----------------
joker-eph wrote:

Isn't the pass possibly removing call sites, thus affecting the symbol table? Do we need to update it as we go?

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


More information about the Mlir-commits mailing list