[llvm] 7e5682e - [ADT] Make TrackingStatistic's ctor constexpr

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 28 03:02:04 PDT 2021


Author: Benjamin Kramer
Date: 2021-04-28T12:00:17+02:00
New Revision: 7e5682ee6201c17b07de326806cf2d19d2f8935a

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

LOG: [ADT] Make TrackingStatistic's ctor constexpr

This lets clang diagnose unused statistics, so remove them.

Added: 
    

Modified: 
    llvm/include/llvm/ADT/Statistic.h
    llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
    llvm/lib/Transforms/IPO/Attributor.cpp
    llvm/lib/Transforms/Utils/BuildLibCalls.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/Statistic.h b/llvm/include/llvm/ADT/Statistic.h
index de7dabc382c37..528d2cdcf61bc 100644
--- a/llvm/include/llvm/ADT/Statistic.h
+++ b/llvm/include/llvm/ADT/Statistic.h
@@ -55,7 +55,8 @@ class TrackingStatistic {
   std::atomic<unsigned> Value;
   std::atomic<bool> Initialized;
 
-  TrackingStatistic(const char *DebugType, const char *Name, const char *Desc)
+  constexpr TrackingStatistic(const char *DebugType, const char *Name,
+                              const char *Desc)
       : DebugType(DebugType), Name(Name), Desc(Desc), Value(0),
         Initialized(false) {}
 

diff  --git a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
index 5385793b258fc..ead953cbb8e54 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
@@ -201,9 +201,6 @@ using namespace llvm;
 
 #define DEBUG_TYPE "livedebugvalues"
 
-STATISTIC(NumInserted, "Number of DBG_VALUE instructions inserted");
-STATISTIC(NumRemoved, "Number of DBG_VALUE instructions removed");
-
 // Act more like the VarLoc implementation, by propagating some locations too
 // far and ignoring some transfers.
 static cl::opt<bool> EmulateOldLDV("emulate-old-livedebugvalues", cl::Hidden,

diff  --git a/llvm/lib/Transforms/IPO/Attributor.cpp b/llvm/lib/Transforms/IPO/Attributor.cpp
index 665abfa210ce1..cc8804f9d9d2b 100644
--- a/llvm/lib/Transforms/IPO/Attributor.cpp
+++ b/llvm/lib/Transforms/IPO/Attributor.cpp
@@ -63,8 +63,6 @@ STATISTIC(NumAttributesValidFixpoint,
           "Number of abstract attributes in a valid fixpoint state");
 STATISTIC(NumAttributesManifested,
           "Number of abstract attributes manifested in IR");
-STATISTIC(NumAttributesFixedDueToRequiredDependences,
-          "Number of abstract attributes fixed due to required dependences");
 
 // TODO: Determine a good default value.
 //

diff  --git a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
index 33740eaee0fbf..0d685c0c87db6 100644
--- a/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
+++ b/llvm/lib/Transforms/Utils/BuildLibCalls.cpp
@@ -44,7 +44,6 @@ STATISTIC(NumSExtArg, "Number of arguments inferred as signext");
 STATISTIC(NumReadOnlyArg, "Number of arguments inferred as readonly");
 STATISTIC(NumNoAlias, "Number of function returns inferred as noalias");
 STATISTIC(NumNoUndef, "Number of function returns inferred as noundef returns");
-STATISTIC(NumNonNull, "Number of function returns inferred as nonnull returns");
 STATISTIC(NumReturnedArg, "Number of arguments inferred as returned");
 STATISTIC(NumWillReturn, "Number of functions inferred as willreturn");
 


        


More information about the llvm-commits mailing list