[Mlir-commits] [flang] [mlir] [mlir][CSE] Introduce hoist-pure-ops logic to CSE pass (PR #180556)

Mehdi Amini llvmlistbot at llvm.org
Sat Feb 28 12:49:37 PST 2026


================
@@ -360,10 +502,16 @@ void CSEDriver::simplifyRegion(ScopedMapTy &knownValues, Region &region) {
 }
 
 void CSEDriver::simplify(Operation *op, bool *changed) {
-  /// Simplify all regions.
-  ScopedMapTy knownValues;
-  for (auto &region : op->getRegions())
-    simplifyRegion(knownValues, region);
+  /// Simplify all regions. Added a new scope using curly braces to release the
+  /// knownPureOps scope before deleting the operation.
+  {
+    ScopedMapTy knownValues;
+    ScopedMapTy knownPureOps;
+    ScopedMapTy::ScopeTy scope(knownPureOps);
+    for (auto &region : op->getRegions()) {
+      simplifyRegion(knownValues, knownPureOps, region);
+    }
----------------
joker-eph wrote:

```suggestion
    for (auto &region : op->getRegions())
      simplifyRegion(knownValues, knownPureOps, region);
```

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


More information about the Mlir-commits mailing list