[llvm] 3b51881 - [CSSPGO] Silence -Wunused-but-set-variable warning without asserts (NFC)

Jie Fu via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 30 19:00:06 PDT 2023


Author: Jie Fu
Date: 2023-08-31T09:58:29+08:00
New Revision: 3b51881dd530f5a8741badf3107c6b5b22516e2c

URL: https://github.com/llvm/llvm-project/commit/3b51881dd530f5a8741badf3107c6b5b22516e2c
DIFF: https://github.com/llvm/llvm-project/commit/3b51881dd530f5a8741badf3107c6b5b22516e2c.diff

LOG: [CSSPGO] Silence -Wunused-but-set-variable warning without asserts (NFC)

/data/home/jiefu/llvm-project/llvm/lib/Transforms/IPO/SampleProfile.cpp:2189:8: error: variable 'IsFuncHashMismatch' set but not used [-Werror,-Wunused-but-set-variable]
  bool IsFuncHashMismatch = false;
       ^
1 error generated.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/IPO/SampleProfile.cpp b/llvm/lib/Transforms/IPO/SampleProfile.cpp
index 3af44b28fec3a3..5ab14445737585 100644
--- a/llvm/lib/Transforms/IPO/SampleProfile.cpp
+++ b/llvm/lib/Transforms/IPO/SampleProfile.cpp
@@ -2186,7 +2186,7 @@ void SampleProfileMatcher::countProfileMismatches(
     const Function &F, const FunctionSamples &FS,
     const std::map<LineLocation, StringRef> &IRAnchors,
     const std::map<LineLocation, StringSet<>> &ProfileAnchors) {
-  bool IsFuncHashMismatch = false;
+  [[maybe_unused]] bool IsFuncHashMismatch = false;
   if (FunctionSamples::ProfileIsProbeBased) {
     TotalFuncHashSamples += FS.getTotalSamples();
     TotalProfiledFunc++;


        


More information about the llvm-commits mailing list