ADT::GenericCycleInfo: Hide validateTree() in -Asserts.

validateTree() is instantiated with __FILE__.
It will be pruned at link time due to -ffunction-sections but be left in
object files.
Its user is only GenericCycleInfo::compute() with assert(validateTree());
Therefore I think validateTree() may be hidden with NDEBUG.

This is a fixup for https://reviews.llvm.org/D112696
This commit is contained in:
NAKAMURA Takumi 2022-05-23 01:03:15 +09:00
parent cba0ebd576
commit cd5f3241c3
2 changed files with 4 additions and 0 deletions

View File

@ -326,6 +326,7 @@ auto GenericCycleInfo<ContextT>::getCycle(const BlockT *Block) const
return nullptr;
}
#ifndef NDEBUG
/// \brief Validate the internal consistency of the cycle tree.
///
/// Note that this does \em not check that cycles are really cycles in the CFG,
@ -391,6 +392,7 @@ bool GenericCycleInfo<ContextT>::validateTree() const {
return true;
}
#endif
/// \brief Print the cycle info.
template <typename ContextT>

View File

@ -249,7 +249,9 @@ public:
/// Methods for debug and self-test.
//@{
#ifndef NDEBUG
bool validateTree() const;
#endif
void print(raw_ostream &Out) const;
void dump() const { print(dbgs()); }
//@}