[Mlir-commits] [mlir] [mlir] Delete visitRegionSuccessors not run code (NFC) (PR #174790)
lonely eagle
llvmlistbot at llvm.org
Wed Jan 7 07:47:42 PST 2026
https://github.com/linuxlonelyeagle created https://github.com/llvm/llvm-project/pull/174790
When the lattices of the predecessor's operands are joined to the lattices of the regionOp's results, their sizes are equal. Therefore, the code inside the 'if' statement will never be executed in this case.
>From cfe195d2e58e3e98084a38f93c63c76393f36023 Mon Sep 17 00:00:00 2001
From: linuxlonelyeagle <2020382038 at qq.com>
Date: Wed, 7 Jan 2026 15:41:34 +0000
Subject: [PATCH] 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));
}
}
More information about the Mlir-commits
mailing list