[PATCH] D120714: [CodeGen] Place SDNode debug ID declaration under ifndef

Duncan P. N. Exon Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 11 11:44:45 PST 2022


dexonsmith added a comment.

Re-reading your comment:

> and a person might want to have `PersistentId` defined in debug build with ABI breaking checks disabled.

I think that person won't get what they want. There are basically two ABIs:

- `LLVM_ENABLE_ABI_BREAKING_CHECKS == 1`: ABI designed for builds that have assertions on.
- `LLVM_ENABLE_ABI_BREAKING_CHECKS == 0`: ABI designed for builds that have assertions off.

The purpose of `LLVM_ENABLE_ABI_BREAKING_CHECKS` is to allow assertions-enabled code to link against assertions-disabled code, as long as they have the same value for `LLVM_ENABLE_ABI_BREAKING_CHECKS`. That comes with caveats:

- A release build with `LLVM_ENABLE_ABI_BREAKING_CHECKS == 1` will have a bloated ABI.
- An asserts build with `LLVM_ENABLE_ABI_BREAKING_CHECKS == 0` will miss some debugging / checks.

But it's better than not supporting cross-linking at all.

(I don't have an opinion about whether there should be an `LLVM_NDEBUG` flag that was used pervasively instead of `NDEBUG`, but I think it's irrelevant for this patch. Even if we had `LLVM_NDEBUG`, then `LLVM_ENABLE_ABI_BREAKING_CHECKS` would still be the right thing to use here.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120714/new/

https://reviews.llvm.org/D120714



More information about the llvm-commits mailing list