diff options
author | Diego Novillo <dnovillo@google.com> | 2015-08-25 15:25:13 +0000 |
---|---|---|
committer | Diego Novillo <dnovillo@google.com> | 2015-08-25 15:25:13 +0000 |
commit | d3ef1083c3ca256188999082b7a3dc97cfd355fd (patch) | |
tree | 88b2c8e1f2fdace5901c7cd91e51e5e406a8bb4a /clang/lib/CodeGen/BackendUtil.cpp | |
parent | 4d71113cdb81af02305f643c9176ba3bfb1be5db (diff) | |
download | bcm5719-llvm-d3ef1083c3ca256188999082b7a3dc97cfd355fd.tar.gz bcm5719-llvm-d3ef1083c3ca256188999082b7a3dc97cfd355fd.zip |
Convert SampleProfile pass into a Module pass.
Eventually, we will need sample profiles to be incorporated into the
inliner's cost models. To do this, we need the sample profile pass to
be a module pass.
This patch makes no functional changes beyond the mechanical adjustments
needed to run SampleProfile as a module pass.
llvm-svn: 245941
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index 7ee8e1fc8a2..55d1a9e13b0 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -166,14 +166,6 @@ static void addObjCARCOptPass(const PassManagerBuilder &Builder, PassManagerBase PM.add(createObjCARCOptPass()); } -static void addSampleProfileLoaderPass(const PassManagerBuilder &Builder, - legacy::PassManagerBase &PM) { - const PassManagerBuilderWrapper &BuilderWrapper = - static_cast<const PassManagerBuilderWrapper &>(Builder); - const CodeGenOptions &CGOpts = BuilderWrapper.getCGOpts(); - PM.add(createSampleProfileLoaderPass(CGOpts.SampleProfileFile)); -} - static void addAddDiscriminatorsPass(const PassManagerBuilder &Builder, legacy::PassManagerBase &PM) { PM.add(createAddDiscriminatorsPass()); @@ -301,10 +293,6 @@ void EmitAssemblyHelper::CreatePasses() { PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, addAddDiscriminatorsPass); - if (!CodeGenOpts.SampleProfileFile.empty()) - PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, - addSampleProfileLoaderPass); - // In ObjC ARC mode, add the main ARC optimization passes. if (LangOpts.ObjCAutoRefCount) { PMBuilder.addExtension(PassManagerBuilder::EP_EarlyAsPossible, @@ -423,6 +411,9 @@ void EmitAssemblyHelper::CreatePasses() { MPM->add(createInstrProfilingPass(Options)); } + if (!CodeGenOpts.SampleProfileFile.empty()) + MPM->add(createSampleProfileLoaderPass(CodeGenOpts.SampleProfileFile)); + PMBuilder.populateModulePassManager(*MPM); } |