[Mlir-commits] [mlir] 222297b - [mlir] Use Region::hasOneBlock (NFC) (#133879)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Apr 1 18:40:25 PDT 2025
Author: Longsheng Mou
Date: 2025-04-02T09:40:22+08:00
New Revision: 222297b02034914499458cfa4772c412ea35573d
URL: https://github.com/llvm/llvm-project/commit/222297b02034914499458cfa4772c412ea35573d
DIFF: https://github.com/llvm/llvm-project/commit/222297b02034914499458cfa4772c412ea35573d.diff
LOG: [mlir] Use Region::hasOneBlock (NFC) (#133879)
Added:
Modified:
mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp
mlir/lib/Transforms/Utils/RegionUtils.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp b/mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp
index 2959d67b366b9..6ffe7afbc727c 100644
--- a/mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp
@@ -308,7 +308,7 @@ LogicalResult LoopOp::verifyRegions() {
return emitOpError(
"should not have 'spirv.mlir.merge' op outside the merge block");
- if (std::next(region.begin()) == region.end())
+ if (region.hasOneBlock())
return emitOpError(
"must have an entry block branching to the loop header block");
// The first block is the entry block.
@@ -502,7 +502,7 @@ LogicalResult SelectionOp::verifyRegions() {
return emitOpError(
"should not have 'spirv.mlir.merge' op outside the merge block");
- if (std::next(region.begin()) == region.end())
+ if (region.hasOneBlock())
return emitOpError("must have a selection header block");
return success();
diff --git a/mlir/lib/Transforms/Utils/RegionUtils.cpp b/mlir/lib/Transforms/Utils/RegionUtils.cpp
index fc9492efa5805..4985d718c1780 100644
--- a/mlir/lib/Transforms/Utils/RegionUtils.cpp
+++ b/mlir/lib/Transforms/Utils/RegionUtils.cpp
@@ -200,7 +200,7 @@ LogicalResult mlir::eraseUnreachableBlocks(RewriterBase &rewriter,
continue;
// If this is a single block region, just collect the nested regions.
- if (std::next(region->begin()) == region->end()) {
+ if (region->hasOneBlock()) {
for (Operation &op : region->front())
for (Region ®ion : op.getRegions())
worklist.push_back(®ion);
More information about the Mlir-commits
mailing list