[Mlir-commits] [mlir] a1133f5 - [MLIR][Transform] Replace NDEBUG guard with LLVM_ENABLE_ABI_BREAKING_CHECKS for checkImplementsTransform (#188736)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Mar 26 06:12:34 PDT 2026
Author: Mehdi Amini
Date: 2026-03-26T13:12:29Z
New Revision: a1133f5e8a24137eea91278fd40365e6c28c4f06
URL: https://github.com/llvm/llvm-project/commit/a1133f5e8a24137eea91278fd40365e6c28c4f06
DIFF: https://github.com/llvm/llvm-project/commit/a1133f5e8a24137eea91278fd40365e6c28c4f06.diff
LOG: [MLIR][Transform] Replace NDEBUG guard with LLVM_ENABLE_ABI_BREAKING_CHECKS for checkImplementsTransform (#188736)
NDEBUG shouldn't be used for guarding ABI changes in header.
Fixes #186552
Assisted-by: Claude Code
Added:
Modified:
mlir/include/mlir/Dialect/Transform/IR/TransformDialect.h
mlir/lib/Dialect/Transform/IR/TransformDialect.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformDialect.h b/mlir/include/mlir/Dialect/Transform/IR/TransformDialect.h
index 494026d78af3f..8e6ac364473af 100644
--- a/mlir/include/mlir/Dialect/Transform/IR/TransformDialect.h
+++ b/mlir/include/mlir/Dialect/Transform/IR/TransformDialect.h
@@ -66,7 +66,7 @@ class TransformDialectData : public detail::TransformDialectDataBase {
: TransformDialectDataBase(TypeID::get<DerivedTy>(), ctx) {}
};
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
namespace detail {
/// Asserts that the operations provided as template arguments implement the
/// TransformOpInterface and MemoryEffectsOpInterface. This must be a dynamic
@@ -79,7 +79,7 @@ void checkImplementsTransformOpInterface(StringRef name, MLIRContext *context);
void checkImplementsTransformHandleTypeInterface(TypeID typeID,
MLIRContext *context);
} // namespace detail
-#endif // NDEBUG
+#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS
} // namespace transform
} // namespace mlir
@@ -256,10 +256,10 @@ void TransformDialect::addOperationIfNotRegistered() {
RegisteredOperationName::lookup(TypeID::get<OpTy>(), getContext());
if (!opName) {
addOperations<OpTy>();
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
StringRef name = OpTy::getOperationName();
detail::checkImplementsTransformOpInterface(name, getContext());
-#endif // NDEBUG
+#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS
return;
}
@@ -289,10 +289,10 @@ void TransformDialect::addTypeIfNotRegistered() {
});
addTypes<Type>();
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
detail::checkImplementsTransformHandleTypeInterface(TypeID::get<Type>(),
getContext());
-#endif // NDEBUG
+#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS
}
template <typename DataTy>
diff --git a/mlir/lib/Dialect/Transform/IR/TransformDialect.cpp b/mlir/lib/Dialect/Transform/IR/TransformDialect.cpp
index 45cef9c162c70..165908d88360d 100644
--- a/mlir/lib/Dialect/Transform/IR/TransformDialect.cpp
+++ b/mlir/lib/Dialect/Transform/IR/TransformDialect.cpp
@@ -24,7 +24,7 @@ using namespace mlir;
#define GET_ATTRDEF_CLASSES
#include "mlir/Dialect/Transform/IR/TransformAttrs.cpp.inc"
-#ifndef NDEBUG
+#if LLVM_ENABLE_ABI_BREAKING_CHECKS
void transform::detail::checkImplementsTransformOpInterface(
StringRef name, MLIRContext *context) {
// Since the operation is being inserted into the Transform dialect and the
@@ -61,7 +61,7 @@ void transform::detail::checkImplementsTransformHandleTypeInterface(
"expected Transform dialect type to implement one of the three "
"interfaces");
}
-#endif // NDEBUG
+#endif // LLVM_ENABLE_ABI_BREAKING_CHECKS
void transform::TransformDialect::initialize() {
// Using the checked versions to enable the same assertions as for the ops
More information about the Mlir-commits
mailing list