[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:59 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:
Mmm, I see your note in the description:
> This is behavior-preserving: the map is read only during the mutation-free collection walk, and all IR erasure happens afterwards in cleanUpDeadVals, so the map cannot become stale while it is in use.
https://github.com/llvm/llvm-project/pull/205448
More information about the Mlir-commits
mailing list