gyiu created this revision. Herald added subscribers: inglorion, mehdi_amini.
Modifications to driver and gold plugin code to get the new pass manager path enabled in LTO (and thinLTO). Repository: rL LLVM https://reviews.llvm.org/D38517 Files: lib/Driver/ToolChains/CommonArgs.cpp tools/gold/gold-plugin.cpp Index: lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- lib/Driver/ToolChains/CommonArgs.cpp +++ lib/Driver/ToolChains/CommonArgs.cpp @@ -454,6 +454,14 @@ CmdArgs.push_back( Args.MakeArgString(Twine("-plugin-opt=sample-profile=") + FName)); } + + // Need this flag to turn on new pass manager via Gold plugin. + if (Args.hasFlag(options::OPT_fexperimental_new_pass_manager, + options::OPT_fno_experimental_new_pass_manager, + /* Default */ false)) { + CmdArgs.push_back("-plugin-opt=new-pass-manager"); + } + } void tools::addArchSpecificRPath(const ToolChain &TC, const ArgList &Args, Index: tools/gold/gold-plugin.cpp =================================================================== --- tools/gold/gold-plugin.cpp +++ tools/gold/gold-plugin.cpp @@ -183,6 +183,8 @@ 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 @@ 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 @@ -810,6 +814,9 @@ 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); }
Index: lib/Driver/ToolChains/CommonArgs.cpp =================================================================== --- lib/Driver/ToolChains/CommonArgs.cpp +++ lib/Driver/ToolChains/CommonArgs.cpp @@ -454,6 +454,14 @@ CmdArgs.push_back( Args.MakeArgString(Twine("-plugin-opt=sample-profile=") + FName)); } + + // Need this flag to turn on new pass manager via Gold plugin. + if (Args.hasFlag(options::OPT_fexperimental_new_pass_manager, + options::OPT_fno_experimental_new_pass_manager, + /* Default */ false)) { + CmdArgs.push_back("-plugin-opt=new-pass-manager"); + } + } void tools::addArchSpecificRPath(const ToolChain &TC, const ArgList &Args, Index: tools/gold/gold-plugin.cpp =================================================================== --- tools/gold/gold-plugin.cpp +++ tools/gold/gold-plugin.cpp @@ -183,6 +183,8 @@ 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 @@ 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 @@ -810,6 +814,9 @@ 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); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits