<html><body><p><font size="2">Hello,</font><br><br><font size="2">I recently noticed that the new pass manager was not enabled at regular/thin LTO link step even if '-fexperimental-new-pass-manager' was specified in the compile step and link step commands.  Upon closer inspection, it seems there's so real way to invoke the new pass manager path ('runNewPMPasses' in lib/LTO/LTOBackend.cpp) during link step.</font><br><br><font size="2">'Conf.UseNewPM' is used to select the new PM in LTOBackend.cpp, but only two places in the code sets it.  The first is through the 'llvm-lto2' tool, and the second during the compile step with '-fthinlto-index=<value>'.  Neither are invoked during LTO/thinLTO link.</font><br><br><font size="2" face="Courier New">tools/llvm-lto2/llvm-lto2.cpp</font><br><font size="2" face="Courier New">...</font><br><font size="2" face="Courier New">static cl::opt<bool></font><br><font size="2" face="Courier New">    UseNewPM("use-new-pm",</font><br><font size="2" face="Courier New">             cl::desc("Run LTO passes using the new pass manager"),</font><br><font size="2" face="Courier New">             cl::init(false), cl::Hidden);</font><br><font size="2" face="Courier New">...</font><br><font size="2" face="Courier New">  </font><b><font size="2" face="Courier New">Conf.UseNewPM</font></b><font size="2" face="Courier New"> = UseNewPM;</font><br><font size="2" face="Courier New">...</font><br><br><font size="2" face="Courier New">projects/clang/lib/CodeGen/BackendUtil.cpp</font><br><font size="2" face="Courier New">...</font><br><font size="2" face="Courier New">void clang::EmitBackendOutput( (...) {</font><br><font size="2" face="Courier New">...</font><br><font size="2" face="Courier New">      runThinLTOBackend(CombinedIndex.get(), M, HeaderOpts, CGOpts, TOpts,</font><br><font size="2" face="Courier New">                        LOpts, std::move(OS), CGOpts.SampleProfileFile, Action);</font><br><font size="2" face="Courier New">      return;</font><br><font size="2" face="Courier New">...</font><br><font size="2" face="Courier New">}</font><br><br><font size="2" face="Courier New">static void runThinLTOBackend (...) {</font><br><font size="2" face="Courier New">...</font><br><font size="2" face="Courier New">  </font><b><font size="2" face="Courier New">Conf.UseNewPM</font></b><font size="2" face="Courier New"> = CGOpts.ExperimentalNewPassManager;</font><br><font size="2" face="Courier New">...</font><br><font size="2" face="Courier New">}</font><br><br><font size="2">My team and I were wondering if this is: </font><ul><ol type="1"><li><font size="2">intentional, </font><li><font size="2">if so, why do we not have an option to enable the new PM in the link step</font><li><font size="2">if not, should we pass an option via '-plugin-opt', or via some other mechanism?  It's unclear to me what the preferred method of passing configuration options to LTO/thinLTO link step is.</font></ol></ul><br><font size="2">Any insights/thoughts/comments would be greatly appreciated.</font><br><br><font size="2">Cheers,</font><br><br><font size="2">Graham Yiu<br>LLVM Compiler Development<br>IBM Toronto Software Lab<br>Office: (905) 413-4077      C2-707/8200/Markham<br>Email: gyiu@ca.ibm.com</font><BR>
</body></html>