[llvm] 36ac72f - [llvm][MemProf] Fix unused variable warning in release build

David Spickett via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 05:53:06 PDT 2025


Author: David Spickett
Date: 2025-06-12T12:52:54Z
New Revision: 36ac72f4e3e4752f85c16363d630f4cfbd682e48

URL: https://github.com/llvm/llvm-project/commit/36ac72f4e3e4752f85c16363d630f4cfbd682e48
DIFF: https://github.com/llvm/llvm-project/commit/36ac72f4e3e4752f85c16363d630f4cfbd682e48.diff

LOG: [llvm][MemProf] Fix unused variable warning in release build

g++-13 warned that:
llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp:1645:8: warning: variable ‘PrevIterCreatedNode’ set but not used [-Wunused-but-set-variable]
 1645 |   bool PrevIterCreatedNode = false;
      |        ^~~~~~~~~~~~~~~~~~~

When asserts were not enabled.

Added: 
    

Modified: 
    llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index f28fe51fb6a5a..10120dd0e10c1 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -1642,7 +1642,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::
   // this entry.
   DenseSet<uint32_t> LastNodeContextIds = LastNode->getContextIds();
 
-  bool PrevIterCreatedNode = false;
+  [[maybe_unused]] bool PrevIterCreatedNode = false;
   bool CreatedNode = false;
   for (unsigned I = 0; I < Calls.size();
        I++, PrevIterCreatedNode = CreatedNode) {


        


More information about the llvm-commits mailing list