[Mlir-commits] [mlir] [MLIR][LLVM] Support for indirectbr (PR #135092)
Tobias Gysi
llvmlistbot at llvm.org
Mon Apr 14 12:46:41 PDT 2025
================
@@ -2240,24 +2240,23 @@ static LogicalResult verifyComdat(Operation *op,
static LogicalResult verifyBlockTags(LLVMFuncOp funcOp) {
llvm::DenseSet<BlockTagAttr> blockTags;
- BlockTagOp badBlockTagOp;
- if (funcOp
- .walk([&](BlockTagOp blockTagOp) {
- if (blockTags.contains(blockTagOp.getTag())) {
- badBlockTagOp = blockTagOp;
- return WalkResult::interrupt();
- }
- blockTags.insert(blockTagOp.getTag());
- return WalkResult::advance();
- })
- .wasInterrupted()) {
- badBlockTagOp.emitError()
- << "duplicate block tag '" << badBlockTagOp.getTag().getId()
- << "' in the same function: ";
- return failure();
- }
+ LogicalResult r = success();
+ // Note that presence of `BlockTagOp`s currently can't prevent an unrecheable
+ // block to be removed by canonicalizer's region simplify pass, which needs to
+ // be dialect aware to allow extra constraints to be described.
+ funcOp.walk([&](BlockTagOp blockTagOp) {
----------------
gysit wrote:
Note that the walk can return a walk result, i.e. you could write:
`WalkResult res = funcOp.walk...`
And then further down you can return failure or success based on the walk result:
`return failure(res.wasInterrupted());`
That is a bit more idiomatic than setting the result in the lambda.
https://github.com/llvm/llvm-project/pull/135092
More information about the Mlir-commits
mailing list