[mlir] Change ABI breaking use of NDEBUG to LLVM_ENABLE_ABI_BREAKING_CHECKS
authorMarkus Böck <markus.boeck02@gmail.com>
Sun, 1 Aug 2021 12:01:20 +0000 (14:01 +0200)
committerMarkus Böck <markus.boeck02@gmail.com>
Sun, 1 Aug 2021 12:01:36 +0000 (14:01 +0200)
commit97335ad13fd4f231a75163a1e5c232aed5efe921
treee0967efb9056eeb7c15540fca5c991b8e1dfe7bc
parent7d855605830f4a524f02b09d6891b351ff716782
[mlir] Change ABI breaking use of NDEBUG to LLVM_ENABLE_ABI_BREAKING_CHECKS

The `DataLayout` class currently contains the member `layoutStack` which is hidden behind a preprocessor region dependant on the NDEBUG macro. Code wise this makes a lot of sense, as the `layoutStack` is used for extra assertions that users will want when compiling a debug build.
It however has the uncomfortable consequence of leading to a different ABI in Debug and Release builds. This I think is a bit annoying for downstream projects and others as they may want to build against a stable Release of MLIR in Release mode, but be able to debug their own project depending on MLIR.

This patch changes the related uses of NDEBUG to LLVM_ENABLE_ABI_BREAKING_CHECKS. As the macro is computed at configure time of LLVM, it may not change based on compiler settings of a downstream projects like NDEBUG would.

Differential Revision: https://reviews.llvm.org/D107227
mlir/include/mlir/Interfaces/DataLayoutInterfaces.h
mlir/lib/Interfaces/DataLayoutInterfaces.cpp