Skip to content

Commit dce0b0b

Browse files
committed
Use more idiomatic failure pattern
1 parent 276ffc6 commit dce0b0b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2240,23 +2240,21 @@ static LogicalResult verifyComdat(Operation *op,
22402240

22412241
static LogicalResult verifyBlockTags(LLVMFuncOp funcOp) {
22422242
llvm::DenseSet<BlockTagAttr> blockTags;
2243-
LogicalResult r = success();
22442243
// Note that presence of `BlockTagOp`s currently can't prevent an unrecheable
22452244
// block to be removed by canonicalizer's region simplify pass, which needs to
22462245
// be dialect aware to allow extra constraints to be described.
2247-
funcOp.walk([&](BlockTagOp blockTagOp) {
2246+
WalkResult res = funcOp.walk([&](BlockTagOp blockTagOp) {
22482247
if (blockTags.contains(blockTagOp.getTag())) {
22492248
blockTagOp.emitError()
22502249
<< "duplicate block tag '" << blockTagOp.getTag().getId()
22512250
<< "' in the same function: ";
2252-
r = failure();
22532251
return WalkResult::interrupt();
22542252
}
22552253
blockTags.insert(blockTagOp.getTag());
22562254
return WalkResult::advance();
22572255
});
22582256

2259-
return r;
2257+
return failure(res.wasInterrupted());
22602258
}
22612259

22622260
/// Parse common attributes that might show up in the same order in both

0 commit comments

Comments
 (0)