This is an archive of the discontinued LLVM Phabricator instance.

[NFC][VPlan] Guard print routines with "#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)"
ClosedPublic

Authored by a.elovikov on Mar 18 2021, 2:11 PM.

Diff Detail

Event Timeline

a.elovikov created this revision.Mar 18 2021, 2:11 PM
a.elovikov requested review of this revision.Mar 18 2021, 2:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 18 2021, 2:11 PM
mehdi_amini accepted this revision.Mar 18 2021, 2:24 PM

Thanks for the cleanup!

llvm/lib/Transforms/Vectorize/VPlanValue.h
356

You may want to tag the dump() ones with LLVM_DUMP_METHOD:

/// Mark debug helper function definitions like dump() that should not be
/// stripped from debug builds.
/// Note that you should also surround dump() functions with
/// `#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)` so they do always
/// get stripped in release builds.
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
#define LLVM_DUMP_METHOD LLVM_ATTRIBUTE_NOINLINE LLVM_ATTRIBUTE_USED
#else
#define LLVM_DUMP_METHOD LLVM_ATTRIBUTE_NOINLINE
#endif

Most places in LLVM would have it defined like this: LLVM_DUMP_METHOD void dump() const;

This revision is now accepted and ready to land.Mar 18 2021, 2:24 PM
This revision was landed with ongoing or failed builds.Mar 19 2021, 10:51 AM
This revision was automatically updated to reflect the committed changes.