summaryrefslogtreecommitdiffstats
path: root/tools/gold
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2016-12-16 16:48:46 +0000
committerDehao Chen <dehao@google.com>2016-12-16 16:48:46 +0000
commit7e4360079c8a8212bf7a4e24916a91a601d5e46f (patch)
tree30a59d929cecbd1a48cbb21d52dc4e89ed3f7c03 /tools/gold
parent1c91fb4936aab5a7b096b606ad97e3a5c39b6e6d (diff)
Pass sample pgo flags to thinlto.
Summary: ThinLTO needs to invoke SampleProfileLoader pass during link time in order to annotate profile correctly after module importing. Reviewers: davidxl, mehdi_amini, tejohnson Subscribers: pcc, davide, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D27790 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289957 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gold')
-rw-r--r--tools/gold/gold-plugin.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/gold/gold-plugin.cpp b/tools/gold/gold-plugin.cpp
index ef0210344016..50e102b04595 100644
--- a/tools/gold/gold-plugin.cpp
+++ b/tools/gold/gold-plugin.cpp
@@ -171,6 +171,8 @@ namespace options {
// Note: This array will contain all plugin options which are not claimed
// as plugin exclusive to pass to the code generator.
static std::vector<const char *> extra;
+ // Sample profile file path
+ static std::string sample_profile;
static void process_plugin_option(const char *opt_)
{
@@ -220,6 +222,8 @@ namespace options {
message(LDPL_FATAL, "Invalid codegen partition level: %s", opt_ + 5);
} else if (opt == "disable-verify") {
DisableVerify = true;
+ } else if (opt.startswith("sample-profile=")) {
+ sample_profile= opt.substr(strlen("sample-profile="));
} else {
// Save this option to pass to the code generator.
// ParseCommandLineOptions() expects argv[0] to be program name. Lazily
@@ -728,6 +732,9 @@ static std::unique_ptr<LTO> createLTO() {
break;
}
+ if (!options::sample_profile.empty())
+ Conf.SampleProfile = options::sample_profile;
+
return llvm::make_unique<LTO>(std::move(Conf), Backend,
options::ParallelCodeGenParallelismLevel);
}