[llvm] 7d49960 - [StackSafety,NFC] Add Stats counters
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 7 14:03:17 PDT 2020
Author: Vitaly Buka
Date: 2020-08-07T14:02:50-07:00
New Revision: 7d4996033bc57c5fa4153a0191ed48f4d287f48c
URL: https://github.com/llvm/llvm-project/commit/7d4996033bc57c5fa4153a0191ed48f4d287f48c
DIFF: https://github.com/llvm/llvm-project/commit/7d4996033bc57c5fa4153a0191ed48f4d287f48c.diff
LOG: [StackSafety,NFC] Add Stats counters
Added:
Modified:
llvm/lib/Analysis/StackSafetyAnalysis.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/StackSafetyAnalysis.cpp b/llvm/lib/Analysis/StackSafetyAnalysis.cpp
index 042062a449c9..0e2c44607e05 100644
--- a/llvm/lib/Analysis/StackSafetyAnalysis.cpp
+++ b/llvm/lib/Analysis/StackSafetyAnalysis.cpp
@@ -45,6 +45,10 @@ STATISTIC(NumModuleCalleeLookupTotal,
"Number of total callee lookups on module index.");
STATISTIC(NumModuleCalleeLookupFailed,
"Number of failed callee lookups on module index.");
+STATISTIC(NumCombinedParamAccessesBefore,
+ "Number of total param accesses before generateParamAccessSummary.");
+STATISTIC(NumCombinedParamAccessesAfter,
+ "Number of total param accesses after generateParamAccessSummary.");
static cl::opt<int> StackSafetyMaxIterations("stack-safety-max-iterations",
cl::init(20), cl::Hidden);
@@ -936,6 +940,18 @@ void llvm::generateParamAccessSummary(ModuleSummaryIndex &Index) {
if (!Index.hasParamAccess())
return;
const ConstantRange FullSet(FunctionSummary::ParamAccess::RangeWidth, true);
+
+ auto CountParamAccesses = [&](StatisticBase &Counter) {
+ if (!AreStatisticsEnabled())
+ return;
+ for (auto &GVS : Index)
+ for (auto &GV : GVS.second.SummaryList)
+ if (FunctionSummary *FS = dyn_cast<FunctionSummary>(GV.get()))
+ NumCombinedParamAccessesAfter += FS->paramAccesses().size();
+ };
+
+ CountParamAccesses(NumCombinedParamAccessesBefore);
+
std::map<const FunctionSummary *, FunctionInfo<FunctionSummary>> Functions;
// Convert the ModuleSummaryIndex to a FunctionMap
@@ -988,6 +1004,8 @@ void llvm::generateParamAccessSummary(ModuleSummaryIndex &Index) {
const_cast<FunctionSummary *>(KV.first)->setParamAccesses(
std::move(NewParams));
}
+
+ CountParamAccesses(NumCombinedParamAccessesAfter);
}
static const char LocalPassArg[] = "stack-safety-local";
More information about the llvm-commits
mailing list