Apply workaround for building llvm-project with WITHOUT_LLVM_ASSERTIONS

Some internal checking functions should only be declared when both
NDEBUG and LLVM_ENABLE_ABI_BREAKING_CHECKS are undefined, otherwise you
would get compile errors similar to:

  /usr/src/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:921:13: error: no member named 'VerifyDAGDivergence' in 'llvm::SelectionDAG'
   921 |     CurDAG->VerifyDAGDivergence();
       |     ~~~~~~  ^

Adjust the conditions for declaring and using these functions. This has
also been reported upstream.

Reported by:	cy
PR:		280562
MFC after:	1 month
This commit is contained in:
Dimitry Andric 2024-10-24 09:02:54 +02:00
parent 4f12b529f4
commit a5b1eecbed
4 changed files with 12 additions and 12 deletions

View file

@ -582,7 +582,7 @@ public:
return Root;
}
#ifndef NDEBUG
#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
void VerifyDAGDivergence();
#endif

View file

@ -55,7 +55,7 @@ public:
AssumptionCache *AC = nullptr;
GCFunctionInfo *GFI = nullptr;
SSPLayoutInfo *SP = nullptr;
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
TargetTransformInfo *TTI = nullptr;
#endif
CodeGenOptLevel OptLevel;

View file

@ -11623,7 +11623,7 @@ void SelectionDAG::CreateTopologicalOrder(std::vector<SDNode *> &Order) {
}
}
#ifndef NDEBUG
#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
void SelectionDAG::VerifyDAGDivergence() {
std::vector<SDNode *> TopoOrder;
CreateTopologicalOrder(TopoOrder);

View file

@ -916,7 +916,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
<< "'\n";
CurDAG->dump());
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
if (TTI->hasBranchDivergence())
CurDAG->VerifyDAGDivergence();
#endif
@ -936,7 +936,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
<< "'\n";
CurDAG->dump());
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
if (TTI->hasBranchDivergence())
CurDAG->VerifyDAGDivergence();
#endif
@ -958,7 +958,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
<< "'\n";
CurDAG->dump());
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
if (TTI->hasBranchDivergence())
CurDAG->VerifyDAGDivergence();
#endif
@ -982,7 +982,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
<< "'\n";
CurDAG->dump());
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
if (TTI->hasBranchDivergence())
CurDAG->VerifyDAGDivergence();
#endif
@ -1000,7 +1000,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
<< "'\n";
CurDAG->dump());
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
if (TTI->hasBranchDivergence())
CurDAG->VerifyDAGDivergence();
#endif
@ -1016,7 +1016,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
<< "'\n";
CurDAG->dump());
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
if (TTI->hasBranchDivergence())
CurDAG->VerifyDAGDivergence();
#endif
@ -1036,7 +1036,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
<< "'\n";
CurDAG->dump());
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
if (TTI->hasBranchDivergence())
CurDAG->VerifyDAGDivergence();
#endif
@ -1056,7 +1056,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
<< "'\n";
CurDAG->dump());
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
if (TTI->hasBranchDivergence())
CurDAG->VerifyDAGDivergence();
#endif
@ -1076,7 +1076,7 @@ void SelectionDAGISel::CodeGenAndEmitDAG() {
<< "'\n";
CurDAG->dump());
#if LLVM_ENABLE_ABI_BREAKING_CHECKS
#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS
if (TTI->hasBranchDivergence())
CurDAG->VerifyDAGDivergence();
#endif