[Mlir-commits] [mlir] [MLIR][LLVM] Support for indirectbr (PR #135092)
Bruno Cardoso Lopes
llvmlistbot at llvm.org
Mon Apr 14 11:47:46 PDT 2025
================
@@ -2306,19 +2306,31 @@ static LogicalResult verifyComdat(Operation *op,
static LogicalResult verifyBlockTags(LLVMFuncOp funcOp) {
llvm::DenseSet<BlockTagAttr> blockTags;
BlockTagOp badBlockTagOp;
+ enum { DupTag, UnrecheableBlock } errorMsgType;
if (funcOp
.walk([&](BlockTagOp blockTagOp) {
+ mlir::Block *block = blockTagOp->getBlock();
+ if (!block->isEntryBlock() && block->use_empty()) {
+ badBlockTagOp = blockTagOp;
+ errorMsgType = UnrecheableBlock;
+ return WalkResult::interrupt();
+ }
+
if (blockTags.contains(blockTagOp.getTag())) {
badBlockTagOp = blockTagOp;
+ errorMsgType = DupTag;
return WalkResult::interrupt();
}
blockTags.insert(blockTagOp.getTag());
return WalkResult::advance();
})
.wasInterrupted()) {
- badBlockTagOp.emitError()
- << "duplicate block tag '" << badBlockTagOp.getTag().getId()
- << "' in the same function: ";
+ if (errorMsgType == DupTag)
+ badBlockTagOp.emitError()
+ << "duplicate block tag '" << badBlockTagOp.getTag().getId()
+ << "' in the same function: ";
+ else
+ badBlockTagOp.emitError() << "not allowed in unrecheable blocks";
----------------
bcardosolopes wrote:
> Note that the LLVM dialect verifier should not be more strict than LLVM propers verifier.
I think in this case it is different because it's encoding a current not-implemented limitation, but I totally agree in principle.
https://github.com/llvm/llvm-project/pull/135092
More information about the Mlir-commits
mailing list