[Mlir-commits] [mlir] [mlir][dataflow] Delete visitRegionSuccessors not run code (NFC) (PR #174790)

lonely eagle llvmlistbot at llvm.org
Wed Jan 7 08:08:08 PST 2026


https://github.com/linuxlonelyeagle updated https://github.com/llvm/llvm-project/pull/174790

>From 429c90ca7ed2d995e7b964b6d5e5b594cf9d7260 Mon Sep 17 00:00:00 2001
From: linuxlonelyeagle <2020382038 at qq.com>
Date: Wed, 7 Jan 2026 15:41:34 +0000
Subject: [PATCH 1/2] delete visitRegionSuccessors not run code.

---
 mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp | 33 +++++++------------
 1 file changed, 12 insertions(+), 21 deletions(-)

diff --git a/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp b/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
index b9d861830dd38..02f0e0b77831d 100644
--- a/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
+++ b/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
@@ -307,29 +307,20 @@ void AbstractSparseForwardDataFlowAnalysis::visitRegionSuccessors(
            "expected the same number of successor inputs as operands");
 
     unsigned firstIndex = 0;
-    if (inputs.size() != lattices.size()) {
-      if (!point->isBlockStart()) {
-        if (!inputs.empty())
-          firstIndex = cast<OpResult>(inputs.front()).getResultNumber();
-        visitNonControlFlowArgumentsImpl(
-            branch,
-            RegionSuccessor(
-                branch, branch->getResults().slice(firstIndex, inputs.size())),
-            lattices, firstIndex);
-      } else {
-        if (!inputs.empty())
-          firstIndex = cast<BlockArgument>(inputs.front()).getArgNumber();
-        Region *region = point->getBlock()->getParent();
-        visitNonControlFlowArgumentsImpl(
-            branch,
-            RegionSuccessor(region, region->getArguments().slice(
-                                        firstIndex, inputs.size())),
-            lattices, firstIndex);
-      }
+    if (inputs.size() != lattices.size() && point->isBlockStart()) {
+      if (!inputs.empty())
+        firstIndex = cast<BlockArgument>(inputs.front()).getArgNumber();
+      Region *region = point->getBlock()->getParent();
+      visitNonControlFlowArgumentsImpl(
+          branch,
+          RegionSuccessor(
+              region, region->getArguments().slice(firstIndex, inputs.size())),
+          lattices, firstIndex);
     }
 
-    for (auto it : llvm::zip(*operands, lattices.drop_front(firstIndex)))
-      join(std::get<1>(it), *getLatticeElementFor(point, std::get<0>(it)));
+    for (auto [lattice, operand] :
+         llvm::zip_equal(lattices.drop_front(firstIndex), *operands))
+      join(lattice, *getLatticeElementFor(point, operand));
   }
 }
 

>From a92e75a848d02e962e0607829e769e19451aa4fb Mon Sep 17 00:00:00 2001
From: linuxlonelyeagle <2020382038 at qq.com>
Date: Wed, 7 Jan 2026 16:07:34 +0000
Subject: [PATCH 2/2] don't use zip_equal.

---
 mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp b/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
index 02f0e0b77831d..695226a49df93 100644
--- a/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
+++ b/mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp
@@ -319,7 +319,7 @@ void AbstractSparseForwardDataFlowAnalysis::visitRegionSuccessors(
     }
 
     for (auto [lattice, operand] :
-         llvm::zip_equal(lattices.drop_front(firstIndex), *operands))
+         llvm::zip(lattices.drop_front(firstIndex), *operands))
       join(lattice, *getLatticeElementFor(point, operand));
   }
 }



More information about the Mlir-commits mailing list