[Mlir-commits] [mlir] [MLIR][SCF] Speed up ConditionPropagation (PR #166080)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Mon Nov 3 01:05:20 PST 2025


================
@@ -2565,6 +2565,38 @@ struct ConvertTrivialIfToSelect : public OpRewritePattern<IfOp> {
 struct ConditionPropagation : public OpRewritePattern<IfOp> {
   using OpRewritePattern<IfOp>::OpRewritePattern;
 
+  enum class Parent { Then, Else, None };
+
+  static Parent getParentType(Region *toCheck, IfOp op,
+                              DenseMap<Region *, Parent> &cache) {
+    SmallVector<Region *> seen;
+    while (toCheck) {
+      auto found = cache.find(toCheck);
+      if (found != cache.end()) {
+        return found->second;
+      }
----------------
ftynse wrote:

```suggestion
      if (found != cache.end())
        return found->second;

```

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


More information about the Mlir-commits mailing list