Skip to content

Commit 1d9ad99

Browse files
authored
[mlir] Use llvm::hasSingleElement (NFC) (llvm#133881)
1 parent 19a3196 commit 1d9ad99

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

mlir/lib/IR/Block.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ bool Block::verifyOpOrder() {
119119
if (!isOpOrderValid())
120120
return false;
121121
// The order is valid if there are less than 2 operations.
122-
if (operations.empty() || std::next(operations.begin()) == operations.end())
122+
if (operations.empty() || llvm::hasSingleElement(operations))
123123
return false;
124124

125125
Operation *prev = nullptr;

mlir/lib/Transforms/Utils/InliningUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ inlineRegionImpl(InlinerInterface &interface, Region *src, Block *inlineBlock,
330330
bool singleBlockFastPath = interface.allowSingleBlockOptimization(newBlocks);
331331

332332
// Handle the case where only a single block was inlined.
333-
if (singleBlockFastPath && std::next(newBlocks.begin()) == newBlocks.end()) {
333+
if (singleBlockFastPath && llvm::hasSingleElement(newBlocks)) {
334334
// Run the result attribute handler on the terminator operands.
335335
Operation *firstBlockTerminator = firstNewBlock->getTerminator();
336336
builder.setInsertionPoint(firstBlockTerminator);

0 commit comments

Comments
 (0)