[Mlir-commits] [mlir] 1c8647a - [mlir] Use llvm::hasSingleElement (NFC) (#133648)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Mar 30 12:21:24 PDT 2025


Author: Kazu Hirata
Date: 2025-03-30T12:21:21-07:00
New Revision: 1c8647a25a5a7527ea546212ddff56ef88ab27b9

URL: https://github.com/llvm/llvm-project/commit/1c8647a25a5a7527ea546212ddff56ef88ab27b9
DIFF: https://github.com/llvm/llvm-project/commit/1c8647a25a5a7527ea546212ddff56ef88ab27b9.diff

LOG: [mlir] Use llvm::hasSingleElement (NFC) (#133648)

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp b/mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp
index bcfd7ebccd12d..2959d67b366b9 100644
--- a/mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp
@@ -255,8 +255,7 @@ static bool hasOneBranchOpTo(Block &srcBlock, Block &dstBlock) {
 
 /// Returns true if the given `block` only contains one `spirv.mlir.merge` op.
 static bool isMergeBlock(Block &block) {
-  return !block.empty() && std::next(block.begin()) == block.end() &&
-         isa<spirv::MergeOp>(block.front());
+  return llvm::hasSingleElement(block) && isa<spirv::MergeOp>(block.front());
 }
 
 /// Returns true if a `spirv.mlir.merge` op outside the merge block.


        


More information about the Mlir-commits mailing list