diff options
| author | Teresa Johnson <tejohnson@google.com> | 2018-06-28 20:07:47 +0000 | 
|---|---|---|
| committer | Teresa Johnson <tejohnson@google.com> | 2018-06-28 20:07:47 +0000 | 
| commit | e87868b7e9178cc404dd9c475fdf56de5d4fb3c2 (patch) | |
| tree | 861cecb07ae185453805407702fb41fa9981ccff /llvm/lib/Transforms | |
| parent | 23d82820470a200c3d80e4f9d4f2102d1c7b17b8 (diff) | |
| download | bcm5719-llvm-e87868b7e9178cc404dd9c475fdf56de5d4fb3c2.tar.gz bcm5719-llvm-e87868b7e9178cc404dd9c475fdf56de5d4fb3c2.zip | |
[ThinLTO] Port InlinerFunctionImportStats handling to new PM
Summary:
The InlinerFunctionImportStats will collect and dump stats regarding how
many function inlined into the module were imported by ThinLTO.
Reviewers: wmi, dexonsmith
Subscribers: mehdi_amini, inglorion, llvm-commits, eraman
Differential Revision: https://reviews.llvm.org/D48729
llvm-svn: 335914
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/IPO/Inliner.cpp | 18 | 
1 files changed, 18 insertions, 0 deletions
| diff --git a/llvm/lib/Transforms/IPO/Inliner.cpp b/llvm/lib/Transforms/IPO/Inliner.cpp index 1698e0ba486..3da0c2e83eb 100644 --- a/llvm/lib/Transforms/IPO/Inliner.cpp +++ b/llvm/lib/Transforms/IPO/Inliner.cpp @@ -793,6 +793,14 @@ bool LegacyInlinerBase::removeDeadFunctions(CallGraph &CG,    return true;  } +InlinerPass::~InlinerPass() { +  if (ImportedFunctionsStats) { +    assert(InlinerFunctionImportStats != InlinerFunctionImportStatsOpts::No); +    ImportedFunctionsStats->dump(InlinerFunctionImportStats == +                                 InlinerFunctionImportStatsOpts::Verbose); +  } +} +  PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,                                     CGSCCAnalysisManager &AM, LazyCallGraph &CG,                                     CGSCCUpdateResult &UR) { @@ -804,6 +812,13 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,    Module &M = *InitialC.begin()->getFunction().getParent();    ProfileSummaryInfo *PSI = MAM.getCachedResult<ProfileSummaryAnalysis>(M); +  if (!ImportedFunctionsStats && +      InlinerFunctionImportStats != InlinerFunctionImportStatsOpts::No) { +    ImportedFunctionsStats = +        llvm::make_unique<ImportedFunctionsInliningStatistics>(); +    ImportedFunctionsStats->setModuleInfo(M); +  } +    // We use a single common worklist for calls across the entire SCC. We    // process these in-order and append new calls introduced during inlining to    // the end. @@ -1009,6 +1024,9 @@ PreservedAnalyses InlinerPass::run(LazyCallGraph::SCC &InitialC,                Calls.push_back({CS, NewHistoryID});        } +      if (InlinerFunctionImportStats != InlinerFunctionImportStatsOpts::No) +        ImportedFunctionsStats->recordInline(F, Callee); +        // Merge the attributes based on the inlining.        AttributeFuncs::mergeAttributesForInlining(F, Callee); | 

