[Mlir-commits] [mlir] [mlir] Fix crash in ForwardDominanceIterator when encountering graph regions (PR #185043)
Mehdi Amini
llvmlistbot at llvm.org
Fri Mar 6 08:54:34 PST 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)) {
----------------
joker-eph wrote:
FYI: I'm not sure this can't just crash with unregistered ops...
https://github.com/llvm/llvm-project/pull/185043
More information about the Mlir-commits
mailing list