[Mlir-commits] [mlir] [mlir] Delete visitRegionSuccessors not run code (NFC) (PR #174790)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Jan 7 07:48:17 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: lonely eagle (linuxlonelyeagle)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/174790.diff
1 Files Affected:
- (modified) mlir/lib/Analysis/DataFlow/SparseAnalysis.cpp (+12-21)
``````````diff
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));
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/174790
More information about the Mlir-commits
mailing list