[mlir] Use llvm::hasSingleElement (NFC) (#133881)

This commit is contained in:
Longsheng Mou 2025-04-01 18:58:50 +08:00 committed by GitHub
parent 19a319667b
commit 1d9ad99305
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -119,7 +119,7 @@ bool Block::verifyOpOrder() {
if (!isOpOrderValid())
return false;
// The order is valid if there are less than 2 operations.
if (operations.empty() || std::next(operations.begin()) == operations.end())
if (operations.empty() || llvm::hasSingleElement(operations))
return false;
Operation *prev = nullptr;

View File

@ -330,7 +330,7 @@ inlineRegionImpl(InlinerInterface &interface, Region *src, Block *inlineBlock,
bool singleBlockFastPath = interface.allowSingleBlockOptimization(newBlocks);
// Handle the case where only a single block was inlined.
if (singleBlockFastPath && std::next(newBlocks.begin()) == newBlocks.end()) {
if (singleBlockFastPath && llvm::hasSingleElement(newBlocks)) {
// Run the result attribute handler on the terminator operands.
Operation *firstBlockTerminator = firstNewBlock->getTerminator();
builder.setInsertionPoint(firstBlockTerminator);