diff options
author | Dehao Chen <dehao@google.com> | 2017-01-12 16:29:25 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-01-12 16:29:25 +0000 |
commit | bd3689de9119e6bd9246216548817411bc5ec5d0 (patch) | |
tree | bf43ff41a4d80bda7e292a62a6044f8cc4d8ff18 /clang/lib/CodeGen/BackendUtil.cpp | |
parent | 3d4cc68b8b748ea31a8d4ab5400f8307718aabe0 (diff) | |
download | llvm-bd3689de9119e6bd9246216548817411bc5ec5d0.zip llvm-bd3689de9119e6bd9246216548817411bc5ec5d0.tar.gz llvm-bd3689de9119e6bd9246216548817411bc5ec5d0.tar.bz2 |
Pass -fprofile-sample-use to lto backends.
Summary: LTO backend will not invoke SampleProfileLoader pass even if -fprofile-sample-use is specified. This patch passes the flag down so that pass manager can add the SampleProfileLoader pass correctly.
Reviewers: mehdi_amini, tejohnson
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D28588
llvm-svn: 291774
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
-rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index d2ce6ea..b70cefa 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -862,7 +862,8 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager( } static void runThinLTOBackend(ModuleSummaryIndex *CombinedIndex, Module *M, - std::unique_ptr<raw_pwrite_stream> OS) { + std::unique_ptr<raw_pwrite_stream> OS, + std::string SampleProfile) { StringMap<std::map<GlobalValue::GUID, GlobalValueSummary *>> ModuleToDefinedGVSummaries; CombinedIndex->collectDefinedGVSummariesPerModule(ModuleToDefinedGVSummaries); @@ -930,6 +931,7 @@ static void runThinLTOBackend(ModuleSummaryIndex *CombinedIndex, Module *M, return llvm::make_unique<lto::NativeObjectStream>(std::move(OS)); }; lto::Config Conf; + Conf.SampleProfile = SampleProfile; if (Error E = thinBackend( Conf, 0, AddStream, *M, *CombinedIndex, ImportList, ModuleToDefinedGVSummaries[M->getModuleIdentifier()], ModuleMap)) { @@ -965,7 +967,8 @@ void clang::EmitBackendOutput(DiagnosticsEngine &Diags, // of an error). bool DoThinLTOBackend = CombinedIndex != nullptr; if (DoThinLTOBackend) { - runThinLTOBackend(CombinedIndex.get(), M, std::move(OS)); + runThinLTOBackend(CombinedIndex.get(), M, std::move(OS), + CGOpts.SampleProfileFile); return; } } |