This is an archive of the discontinued LLVM Phabricator instance.

Provide the same ABI regardless of NDEBUG
ClosedPublic

Authored by gribozavr on Feb 15 2015, 10:58 PM.

Details

Summary

For projects depending on LLVM, I find it very useful to combine a release-no-asserts build of LLVM with a debug+asserts build of the dependent project. The motivation is that when developing an dependent project, you are debugging that project itself, not LLVM. In my usecase, a significant part of the runtime is spent in LLVM optimization passes, so I would like to build LLVM without assertions to get the best performance from this combination.

Currently, lib/Support/Debug.cpp changes the set of symbols it provides depending on NDEBUG, while include/llvm/Support/Debug.h requires a different extra symbols when NDEBUG is not defined. Thus, it is not possible to enable assertions in an external project that uses facilities of Debug.h.

This patch changes Debug.cpp and Valgrind.cpp to always define the symbols that other code may depend on when #including LLVM headers without NDEBUG.

Diff Detail

Event Timeline

gribozavr updated this revision to Diff 20002.Feb 15 2015, 10:58 PM
gribozavr retitled this revision from to Provide the same ABI regardless of NDEBUG.
gribozavr updated this object.
gribozavr edited the test plan for this revision. (Show Details)
gribozavr added a subscriber: Unknown Object (MLST).
doug.gregor accepted this revision.Feb 17 2015, 9:25 AM
doug.gregor added a reviewer: doug.gregor.
doug.gregor added a subscriber: doug.gregor.

This LGTM.

This revision is now accepted and ready to land.Feb 17 2015, 9:25 AM
silvas edited edge metadata.Feb 18 2015, 5:37 PM

LGTM. This sounds like a useful configuration to support.

gribozavr closed this revision.Feb 18 2015, 9:33 PM

Thanks!

Committed as r229819.