[llvm-branch-commits] [mlir] [MLIR] Stop visiting unreachable blocks in the walkAndApplyPatterns driver (PR #154038)
Jakub Kuderski via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Aug 17 17:17:42 PDT 2025
================
@@ -98,13 +118,18 @@ void walkAndApplyPatterns(Operation *op,
regionIt = region->begin();
if (regionIt != region->end())
blockIt = regionIt->begin();
+ if (!llvm::hasSingleElement(*region))
+ findReachableBlocks(*region, reachableBlocks);
}
// Advance the iterator to the next reachable operation.
void advance() {
assert(regionIt != region->end());
hasVisitedRegions = false;
if (blockIt == regionIt->end()) {
regionIt++;
+ while (regionIt != region->end() &&
+ !reachableBlocks.contains(&*regionIt))
+ regionIt++;
----------------
kuhar wrote:
```suggestion
++regionIt;
```
Per https://llvm.org/docs/CodingStandards.html#prefer-preincrement
https://github.com/llvm/llvm-project/pull/154038
More information about the llvm-branch-commits
mailing list