diff options
author | Teresa Johnson <tejohnson@google.com> | 2018-10-16 23:49:50 +0000 |
---|---|---|
committer | Teresa Johnson <tejohnson@google.com> | 2018-10-16 23:49:50 +0000 |
commit | d2c234a4cca97a272fe90d836313374c3007400b (patch) | |
tree | d2434f2f15e498eff927c536cb78ea62aebd8aee /llvm/lib/Transforms/IPO/FunctionImport.cpp | |
parent | 5eb8cba2808aeb7830f768f1fd48fc798a44e81c (diff) | |
download | bcm5719-llvm-d2c234a4cca97a272fe90d836313374c3007400b.tar.gz bcm5719-llvm-d2c234a4cca97a272fe90d836313374c3007400b.zip |
[ThinLTO] Add importing stats to thin link
Summary:
Previously we could only get the number of imported functions and
variables from the backend. This adds stats to the thin link where the
importing is decided.
Reviewers: wmi
Subscribers: inglorion, dexonsmith, llvm-commits
Differential Revision: https://reviews.llvm.org/D53337
llvm-svn: 344658
Diffstat (limited to 'llvm/lib/Transforms/IPO/FunctionImport.cpp')
-rw-r--r-- | llvm/lib/Transforms/IPO/FunctionImport.cpp | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionImport.cpp b/llvm/lib/Transforms/IPO/FunctionImport.cpp index 366ac2b95f4..16a3d112b29 100644 --- a/llvm/lib/Transforms/IPO/FunctionImport.cpp +++ b/llvm/lib/Transforms/IPO/FunctionImport.cpp @@ -60,8 +60,17 @@ using namespace llvm; #define DEBUG_TYPE "function-import" -STATISTIC(NumImportedFunctions, "Number of functions imported"); -STATISTIC(NumImportedGlobalVars, "Number of global variables imported"); +STATISTIC(NumImportedFunctionsThinLink, + "Number of functions thin link decided to import"); +STATISTIC(NumImportedHotFunctionsThinLink, + "Number of hot functions thin link decided to import"); +STATISTIC(NumImportedCriticalFunctionsThinLink, + "Number of critical functions thin link decided to import"); +STATISTIC(NumImportedGlobalVarsThinLink, + "Number of global variables thin link decided to import"); +STATISTIC(NumImportedFunctions, "Number of functions imported in backend"); +STATISTIC(NumImportedGlobalVars, + "Number of global variables imported in backend"); STATISTIC(NumImportedModules, "Number of modules imported from"); STATISTIC(NumDeadSymbols, "Number of dead stripped symbols in index"); STATISTIC(NumLiveSymbols, "Number of live symbols in index"); @@ -281,7 +290,10 @@ static void computeImportForReferencedGlobals( !RefSummary->notEligibleToImport() && !GlobalValue::isInterposableLinkage(RefSummary->linkage()) && RefSummary->refs().empty()) { - ImportList[RefSummary->modulePath()].insert(VI.getGUID()); + auto ILI = ImportList[RefSummary->modulePath()].insert(VI.getGUID()); + // Only update stat if we haven't already imported this variable. + if (ILI.second) + NumImportedGlobalVarsThinLink++; if (ExportLists) (*ExportLists)[RefSummary->modulePath()].insert(VI.getGUID()); break; @@ -363,6 +375,11 @@ static void computeImportForFunction( auto &CalleeSummary = std::get<1>(IT.first->second); auto &FailureInfo = std::get<2>(IT.first->second); + bool IsHotCallsite = + Edge.second.getHotness() == CalleeInfo::HotnessType::Hot; + bool IsCriticalCallsite = + Edge.second.getHotness() == CalleeInfo::HotnessType::Critical; + const FunctionSummary *ResolvedCalleeSummary = nullptr; if (CalleeSummary) { assert(PreviouslyVisited); @@ -434,6 +451,13 @@ static void computeImportForFunction( // We previously decided to import this GUID definition if it was already // inserted in the set of imports from the exporting module. bool PreviouslyImported = !ILI.second; + if (!PreviouslyImported) { + NumImportedFunctionsThinLink++; + if (IsHotCallsite) + NumImportedHotFunctionsThinLink++; + if (IsCriticalCallsite) + NumImportedCriticalFunctionsThinLink++; + } // Make exports in the source module. if (ExportLists) { @@ -467,8 +491,6 @@ static void computeImportForFunction( return Threshold * ImportInstrFactor; }; - bool IsHotCallsite = - Edge.second.getHotness() == CalleeInfo::HotnessType::Hot; const auto AdjThreshold = GetAdjustedThreshold(Threshold, IsHotCallsite); ImportCount++; |