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

Mehdi AMINI via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 18 14:25:00 PDT 2021


mehdi_amini accepted this revision.
mehdi_amini added a comment.
This revision is now accepted and ready to land.

Thanks for the cleanup!



================
Comment at: llvm/lib/Transforms/Vectorize/VPlanValue.h:356
   /// Dump the VPDef to stderr (for debugging).
   void dump() const;
 
----------------
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;`



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98897



More information about the llvm-commits mailing list