]> granicus.if.org Git - llvm/commitdiff
Enabling new pass manager in LTO (and thinLTO) link step.
authorSean Fertile <sfertile@ca.ibm.com>
Thu, 5 Oct 2017 01:48:42 +0000 (01:48 +0000)
committerSean Fertile <sfertile@ca.ibm.com>
Thu, 5 Oct 2017 01:48:42 +0000 (01:48 +0000)
Adds the option 'new-pass-manager' to the gold pluggin to enable using the
new pass manager during the lto/thinlto link step.

Patch by Graham Yiu.

 Differential Revision: https://reviews.llvm.org/D38517

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@314963 91177308-0d34-0410-b5e6-96231b3b80d8

tools/gold/gold-plugin.cpp

index 9c6de14af65937c854115eb64e81a13eda5adcff..cf575d0a460f2afae57b58045a32f73a328e0d08 100644 (file)
@@ -183,6 +183,8 @@ namespace options {
   static std::vector<const char *> extra;
   // Sample profile file path
   static std::string sample_profile;
+  // New pass manager
+  static bool new_pass_manager = false;
 
   static void process_plugin_option(const char *opt_)
   {
@@ -242,6 +244,8 @@ namespace options {
       DisableVerify = true;
     } else if (opt.startswith("sample-profile=")) {
       sample_profile= opt.substr(strlen("sample-profile="));
+    } else if (opt == "new-pass-manager") {
+      new_pass_manager = true;
     } else {
       // Save this option to pass to the code generator.
       // ParseCommandLineOptions() expects argv[0] to be program name. Lazily
@@ -805,6 +809,9 @@ static std::unique_ptr<LTO> createLTO() {
   if (!options::sample_profile.empty())
     Conf.SampleProfile = options::sample_profile;
 
+  // Use new pass manager if set in driver
+  Conf.UseNewPM = options::new_pass_manager;
+
   return llvm::make_unique<LTO>(std::move(Conf), Backend,
                                 options::ParallelCodeGenParallelismLevel);
 }