[flang-commits] [flang] [mlir] [mlir][CSE] Add pruneDeadOps to CSE pass (PR #193778)

Mehdi Amini via flang-commits flang-commits at lists.llvm.org
Mon May 4 04:34:17 PDT 2026


================
@@ -294,15 +297,38 @@ LogicalResult CSEDriver::simplifyOperation(ScopedMapTy &knownValues,
   return failure();
 }
 
+void CSEDriver::pruneDeadOps(Operation *root, ScopedMapTy &knownValues) {
+  // We use `SetVector` to prevent already inserted ops from being added to the
+  // `worklist` repeatedly, avoiding secondary access to erased operations.
+  llvm::SetVector<Operation *> worklist;
----------------
joker-eph wrote:

Here is a draft PR: https://github.com/llvm/llvm-project/pull/195636

(draft because I was still reviewing it but had some errands to run, will get back to it later).

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


More information about the flang-commits mailing list