diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2017-01-20 22:18:52 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2017-01-20 22:18:52 +0000 |
commit | e02b74e294132ae3b34eee2d91b46c830dc2b21b (patch) | |
tree | 4c88f8cfd6a7637723d955748add56b6766acc06 /llvm/lib/LTO/LTOBackend.cpp | |
parent | 0c1c70aef4a1d97188fde20e894bafeccd64224c (diff) | |
download | bcm5719-llvm-e02b74e294132ae3b34eee2d91b46c830dc2b21b.tar.gz bcm5719-llvm-e02b74e294132ae3b34eee2d91b46c830dc2b21b.zip |
IPO, LTO: Plumb the summary from the LTO API into the pass manager.
Differential Revision: https://reviews.llvm.org/D28840
llvm-svn: 292661
Diffstat (limited to 'llvm/lib/LTO/LTOBackend.cpp')
-rw-r--r-- | llvm/lib/LTO/LTOBackend.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp index 809db80bc91..f2cb8563298 100644 --- a/llvm/lib/LTO/LTOBackend.cpp +++ b/llvm/lib/LTO/LTOBackend.cpp @@ -168,13 +168,14 @@ static void runNewPMCustomPasses(Module &Mod, TargetMachine *TM, } static void runOldPMPasses(Config &Conf, Module &Mod, TargetMachine *TM, - bool IsThinLTO) { + bool IsThinLTO, ModuleSummaryIndex &CombinedIndex) { legacy::PassManager passes; passes.add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis())); PassManagerBuilder PMB; PMB.LibraryInfo = new TargetLibraryInfoImpl(Triple(TM->getTargetTriple())); PMB.Inliner = createFunctionInliningPass(); + PMB.Summary = &CombinedIndex; // Unconditionally verify input since it is not verified before this // point and has unknown origin. PMB.VerifyInput = true; @@ -191,10 +192,11 @@ static void runOldPMPasses(Config &Conf, Module &Mod, TargetMachine *TM, } bool opt(Config &Conf, TargetMachine *TM, unsigned Task, Module &Mod, - bool IsThinLTO) { + bool IsThinLTO, ModuleSummaryIndex &CombinedIndex) { if (Conf.OptPipeline.empty()) - runOldPMPasses(Conf, Mod, TM, IsThinLTO); + runOldPMPasses(Conf, Mod, TM, IsThinLTO, CombinedIndex); else + // FIXME: Plumb the combined index into the new pass manager. runNewPMCustomPasses(Mod, TM, Conf.OptPipeline, Conf.AAPipeline, Conf.DisableVerify); return !Conf.PostOptModuleHook || Conf.PostOptModuleHook(Task, Mod); @@ -291,7 +293,8 @@ static void handleAsmUndefinedRefs(Module &Mod, TargetMachine &TM) { Error lto::backend(Config &C, AddStreamFn AddStream, unsigned ParallelCodeGenParallelismLevel, - std::unique_ptr<Module> Mod) { + std::unique_ptr<Module> Mod, + ModuleSummaryIndex &CombinedIndex) { Expected<const Target *> TOrErr = initAndLookupTarget(C, *Mod); if (!TOrErr) return TOrErr.takeError(); @@ -302,7 +305,7 @@ Error lto::backend(Config &C, AddStreamFn AddStream, handleAsmUndefinedRefs(*Mod, *TM); if (!C.CodeGenOnly) - if (!opt(C, TM.get(), 0, *Mod, /*IsThinLTO=*/false)) + if (!opt(C, TM.get(), 0, *Mod, /*IsThinLTO=*/false, CombinedIndex)) return Error::success(); if (ParallelCodeGenParallelismLevel == 1) { @@ -367,7 +370,7 @@ Error lto::thinBackend(Config &Conf, unsigned Task, AddStreamFn AddStream, if (Conf.PostImportModuleHook && !Conf.PostImportModuleHook(Task, Mod)) return Error::success(); - if (!opt(Conf, TM.get(), Task, Mod, /*IsThinLTO=*/true)) + if (!opt(Conf, TM.get(), Task, Mod, /*IsThinLTO=*/true, CombinedIndex)) return Error::success(); codegen(Conf, TM.get(), AddStream, Task, Mod); |