llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-mlir-core Author: Matthias Springer (matthias-springer) <details> <summary>Changes</summary> Add extra assertions to make sure that a value in the conversion value mapping is not overwritten during `applySignatureConversion`. Depends on #<!-- -->121644. --- Full diff: https://github.com/llvm/llvm-project/pull/121646.diff 1 Files Affected: - (modified) mlir/lib/Transforms/Utils/DialectConversion.cpp (+8) ``````````diff diff --git a/mlir/lib/Transforms/Utils/DialectConversion.cpp b/mlir/lib/Transforms/Utils/DialectConversion.cpp index 4904d3ce3f8635..3201fad613d294 100644 --- a/mlir/lib/Transforms/Utils/DialectConversion.cpp +++ b/mlir/lib/Transforms/Utils/DialectConversion.cpp @@ -1364,6 +1364,14 @@ Block *ConversionPatternRewriterImpl::applySignatureConversion( if (hasRewrite<BlockTypeConversionRewrite>(rewrites, block)) llvm::report_fatal_error("block was already converted"); #endif // MLIR_ENABLE_EXPENSIVE_PATTERN_API_CHECKS +#ifndef NDEBUG + // This check detects the following cases: + // * Attempting to convert the same block multiple times. + // * Block argument replaced, then attempting to convert the block. + for (BlockArgument arg : block->getArguments()) + assert(mapping.lookupOrNull(arg).empty() && + "cannot convert block whose arguments have been replaced"); +#endif // NDEBUG OpBuilder::InsertionGuard g(rewriter); `````````` </details> https://github.com/llvm/llvm-project/pull/121646 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits