@@ -45,6 +45,10 @@ STATISTIC(NumModuleCalleeLookupTotal,
45
45
" Number of total callee lookups on module index." );
46
46
STATISTIC (NumModuleCalleeLookupFailed,
47
47
" Number of failed callee lookups on module index." );
48
+ STATISTIC (NumCombinedParamAccessesBefore,
49
+ " Number of total param accesses before generateParamAccessSummary." );
50
+ STATISTIC (NumCombinedParamAccessesAfter,
51
+ " Number of total param accesses after generateParamAccessSummary." );
48
52
49
53
static cl::opt<int > StackSafetyMaxIterations (" stack-safety-max-iterations" ,
50
54
cl::init (20 ), cl::Hidden);
@@ -936,6 +940,18 @@ void llvm::generateParamAccessSummary(ModuleSummaryIndex &Index) {
936
940
if (!Index.hasParamAccess ())
937
941
return ;
938
942
const ConstantRange FullSet (FunctionSummary::ParamAccess::RangeWidth, true );
943
+
944
+ auto CountParamAccesses = [&](StatisticBase &Counter) {
945
+ if (!AreStatisticsEnabled ())
946
+ return ;
947
+ for (auto &GVS : Index)
948
+ for (auto &GV : GVS.second .SummaryList )
949
+ if (FunctionSummary *FS = dyn_cast<FunctionSummary>(GV.get ()))
950
+ NumCombinedParamAccessesAfter += FS->paramAccesses ().size ();
951
+ };
952
+
953
+ CountParamAccesses (NumCombinedParamAccessesBefore);
954
+
939
955
std::map<const FunctionSummary *, FunctionInfo<FunctionSummary>> Functions;
940
956
941
957
// Convert the ModuleSummaryIndex to a FunctionMap
@@ -988,6 +1004,8 @@ void llvm::generateParamAccessSummary(ModuleSummaryIndex &Index) {
988
1004
const_cast <FunctionSummary *>(KV.first )->setParamAccesses (
989
1005
std::move (NewParams));
990
1006
}
1007
+
1008
+ CountParamAccesses (NumCombinedParamAccessesAfter);
991
1009
}
992
1010
993
1011
static const char LocalPassArg[] = " stack-safety-local" ;
0 commit comments