[clang] [llvm] [WPD]: Apply speculative WPD in non-lto mode. (PR #145031)

Teresa Johnson via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 4 10:56:25 PDT 2025


================
@@ -1629,6 +1630,23 @@ PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
   if (!LTOPreLink)
     MPM.addPass(RelLookupTableConverterPass());
 
+  if (PTO.WholeProgramDevirt && LTOPhase == ThinOrFullLTOPhase::None) {
+    MPM.addPass(WholeProgramDevirtPass(/*ExportSummary*/ nullptr,
+                                       /*ImportSummary*/ nullptr,
+                                       /*InLTOMode=*/false));
+    MPM.addPass(LowerTypeTestsPass(nullptr, nullptr,
+                                   lowertypetests::DropTestKind::Assume));
+    if (EnableModuleInliner) {
+      MPM.addPass(ModuleInlinerPass(getInlineParamsFromOptLevel(Level),
----------------
teresajohnson wrote:

Can you summarize this info in a comment (i.e. specifically why another round of inlining is needed in non-LTO mode but effectively already exists elsewhere in LTO mode)?

https://github.com/llvm/llvm-project/pull/145031


More information about the cfe-commits mailing list