diff options
author | Dehao Chen <dehao@google.com> | 2017-01-13 00:51:55 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-01-13 00:51:55 +0000 |
commit | a1bd2d658570734c0111d774e3ad4580913f2ea3 (patch) | |
tree | 520a2e7c3aee59e196bf99d8aad4b2cf601becf8 /clang/lib | |
parent | b570195c3a76bc60deb562023fc1865368c234fb (diff) | |
download | bcm5719-llvm-a1bd2d658570734c0111d774e3ad4580913f2ea3.tar.gz bcm5719-llvm-a1bd2d658570734c0111d774e3ad4580913f2ea3.zip |
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: 291870
Diffstat (limited to 'clang/lib')
-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 d2ce6ea48e4..b70cefa615f 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; } } |