aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/BackendUtil.cpp
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2017-01-12 16:29:25 +0000
committerDehao Chen <dehao@google.com>2017-01-12 16:29:25 +0000
commitbd3689de9119e6bd9246216548817411bc5ec5d0 (patch)
treebf43ff41a4d80bda7e292a62a6044f8cc4d8ff18 /clang/lib/CodeGen/BackendUtil.cpp
parent3d4cc68b8b748ea31a8d4ab5400f8307718aabe0 (diff)
downloadllvm-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.cpp7
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;
}
}