[llvm] d27614e - [llvm-profdata] Modernize SampleOverlapStats (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 19 07:56:49 PDT 2023


Author: Kazu Hirata
Date: 2023-08-19T07:56:37-07:00
New Revision: d27614e1d3e54505e80774aa86733de2d82e2453

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

LOG: [llvm-profdata] Modernize SampleOverlapStats (NFC)

Added: 
    

Modified: 
    llvm/tools/llvm-profdata/llvm-profdata.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 4592dc0d77a49d..fdb2c1405f1237 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -1380,35 +1380,31 @@ struct SampleOverlapStats {
   SampleContext BaseName;
   SampleContext TestName;
   // Number of overlap units
-  uint64_t OverlapCount;
+  uint64_t OverlapCount = 0;
   // Total samples of overlap units
-  uint64_t OverlapSample;
+  uint64_t OverlapSample = 0;
   // Number of and total samples of units that only present in base or test
   // profile
-  uint64_t BaseUniqueCount;
-  uint64_t BaseUniqueSample;
-  uint64_t TestUniqueCount;
-  uint64_t TestUniqueSample;
+  uint64_t BaseUniqueCount = 0;
+  uint64_t BaseUniqueSample = 0;
+  uint64_t TestUniqueCount = 0;
+  uint64_t TestUniqueSample = 0;
   // Number of units and total samples in base or test profile
-  uint64_t BaseCount;
-  uint64_t BaseSample;
-  uint64_t TestCount;
-  uint64_t TestSample;
+  uint64_t BaseCount = 0;
+  uint64_t BaseSample = 0;
+  uint64_t TestCount = 0;
+  uint64_t TestSample = 0;
   // Number of and total samples of units that present in at least one profile
-  uint64_t UnionCount;
-  uint64_t UnionSample;
+  uint64_t UnionCount = 0;
+  uint64_t UnionSample = 0;
   // Weighted similarity
-  double Similarity;
+  double Similarity = 0.0;
   // For SampleOverlapStats instances representing functions, weights of the
   // function in base and test profiles
-  double BaseWeight;
-  double TestWeight;
-
-  SampleOverlapStats()
-      : OverlapCount(0), OverlapSample(0), BaseUniqueCount(0),
-        BaseUniqueSample(0), TestUniqueCount(0), TestUniqueSample(0),
-        BaseCount(0), BaseSample(0), TestCount(0), TestSample(0), UnionCount(0),
-        UnionSample(0), Similarity(0.0), BaseWeight(0.0), TestWeight(0.0) {}
+  double BaseWeight = 0.0;
+  double TestWeight = 0.0;
+
+  SampleOverlapStats() = default;
 };
 } // end anonymous namespace
 


        


More information about the llvm-commits mailing list