[llvm] cd5f324 - ADT::GenericCycleInfo: Hide validateTree() in -Asserts.
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Sun May 22 09:15:38 PDT 2022
Author: NAKAMURA Takumi
Date: 2022-05-23T01:15:02+09:00
New Revision: cd5f3241c3866da0ba7ede4b96d1a110108214dd
URL: https://github.com/llvm/llvm-project/commit/cd5f3241c3866da0ba7ede4b96d1a110108214dd
DIFF: https://github.com/llvm/llvm-project/commit/cd5f3241c3866da0ba7ede4b96d1a110108214dd.diff
LOG: 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
Added:
Modified:
llvm/include/llvm/ADT/GenericCycleImpl.h
llvm/include/llvm/ADT/GenericCycleInfo.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/GenericCycleImpl.h b/llvm/include/llvm/ADT/GenericCycleImpl.h
index 494b415cc2794..17f3a793c985b 100644
--- a/llvm/include/llvm/ADT/GenericCycleImpl.h
+++ b/llvm/include/llvm/ADT/GenericCycleImpl.h
@@ -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>
diff --git a/llvm/include/llvm/ADT/GenericCycleInfo.h b/llvm/include/llvm/ADT/GenericCycleInfo.h
index 7228559dfc335..5c2190411c1e0 100644
--- a/llvm/include/llvm/ADT/GenericCycleInfo.h
+++ b/llvm/include/llvm/ADT/GenericCycleInfo.h
@@ -249,7 +249,9 @@ template <typename ContextT> class GenericCycleInfo {
/// Methods for debug and self-test.
//@{
+#ifndef NDEBUG
bool validateTree() const;
+#endif
void print(raw_ostream &Out) const;
void dump() const { print(dbgs()); }
//@}
More information about the llvm-commits
mailing list