Skip to content

Conversation

svenvh
Copy link
Member

@svenvh svenvh commented Sep 18, 2025

The NDEBUG macro is tested for defined-ness everywhere else. The instance here triggers a warning when compiling with -Wundef.

The `NDEBUG` macro is tested for defined-ness everywhere else.  The
instance here triggers a warning when compiling with `-Wundef`.
@svenvh svenvh requested a review from mtrofin September 18, 2025 09:49
@llvmbot llvmbot added PGO Profile Guided Optimizations llvm:transforms labels Sep 18, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 18, 2025

@llvm/pr-subscribers-pgo

@llvm/pr-subscribers-llvm-transforms

Author: Sven van Haastregt (svenvh)

Changes

The NDEBUG macro is tested for defined-ness everywhere else. The instance here triggers a warning when compiling with -Wundef.


Full diff: https://github.com/llvm/llvm-project/pull/159539.diff

1 Files Affected:

  • (modified) llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp (+1-1)
diff --git a/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp b/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
index d741695d4e53c..0a358d45b92ca 100644
--- a/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
+++ b/llvm/lib/Transforms/Instrumentation/PGOCtxProfLowering.cpp
@@ -98,7 +98,7 @@ std::pair<uint32_t, uint32_t> getNumCountersAndCallsites(const Function &F) {
                "same total nr of callsites parameter");
         NumCallsites = V;
       }
-#if NDEBUG
+#ifdef NDEBUG
       if (NumCounters && NumCallsites)
         return std::make_pair(NumCounters, NumCallsites);
 #endif

@svenvh svenvh merged commit 91dba22 into llvm:main Sep 19, 2025
12 checks passed
@svenvh svenvh deleted the wundef-ndebug branch September 19, 2025 09:51
SeongjaeP pushed a commit to SeongjaeP/llvm-project that referenced this pull request Sep 23, 2025
The `NDEBUG` macro is tested for defined-ness everywhere else. The
instance here triggers a warning when compiling with `-Wundef`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
llvm:transforms PGO Profile Guided Optimizations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants