Skip to content

Commit 222297b

Browse files
authored
[mlir] Use Region::hasOneBlock (NFC) (#133879)
1 parent 4696831 commit 222297b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ LogicalResult LoopOp::verifyRegions() {
308308
return emitOpError(
309309
"should not have 'spirv.mlir.merge' op outside the merge block");
310310

311-
if (std::next(region.begin()) == region.end())
311+
if (region.hasOneBlock())
312312
return emitOpError(
313313
"must have an entry block branching to the loop header block");
314314
// The first block is the entry block.
@@ -502,7 +502,7 @@ LogicalResult SelectionOp::verifyRegions() {
502502
return emitOpError(
503503
"should not have 'spirv.mlir.merge' op outside the merge block");
504504

505-
if (std::next(region.begin()) == region.end())
505+
if (region.hasOneBlock())
506506
return emitOpError("must have a selection header block");
507507

508508
return success();

mlir/lib/Transforms/Utils/RegionUtils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ LogicalResult mlir::eraseUnreachableBlocks(RewriterBase &rewriter,
200200
continue;
201201

202202
// If this is a single block region, just collect the nested regions.
203-
if (std::next(region->begin()) == region->end()) {
203+
if (region->hasOneBlock()) {
204204
for (Operation &op : region->front())
205205
for (Region &region : op.getRegions())
206206
worklist.push_back(&region);

0 commit comments

Comments
 (0)