[Mlir-commits] [mlir] [mlir] Fix crash in ForwardDominanceIterator when encountering graph regions (PR #185043)
Matthias Springer
llvmlistbot at llvm.org
Mon Mar 9 01:16:57 PDT 2026
================
@@ -40,25 +40,26 @@ struct ReverseIterator {
/// enumerated according to their successor relationship. Unreachable blocks are
/// not enumerated. Blocks may not be erased during the traversal.
///
-/// Note: If `NoGraphRegions` is set to "true", this iterator asserts that each
-/// visited region has SSA dominance. In either case, the ops in such regions
-/// are visited in forward order, but for regions without SSA dominance this
-/// does not guarantee that defining ops are visited before their users.
+/// Note: If `NoGraphRegions` is set to "true", graph regions (regions without
+/// SSA dominance) are skipped during the traversal. If set to "false" (the
+/// default), graph regions are visited but without dominance guarantees (i.e.,
+/// defining ops are not guaranteed to be visited before their users).
template <bool NoGraphRegions = false>
struct ForwardDominanceIterator {
static Block &makeIterable(Block &range) {
return ForwardIterator::makeIterable(range);
}
static auto makeIterable(Region ®ion) {
- if (NoGraphRegions) {
- // Only regions with SSA dominance are allowed.
- assert(mayHaveSSADominance(region) && "graph regions are not allowed");
+ Block *null = nullptr;
+ if (NoGraphRegions && !mayHaveSSADominance(region)) {
----------------
matthias-springer wrote:
I would expand the documentation of `ForwardDominanceIterator` to say that ops in regions of unregistered ops are iterated over as if they were SSACFG regions.
https://github.com/llvm/llvm-project/pull/185043
More information about the Mlir-commits
mailing list