================
@@ -1641,6 +1642,24 @@ 
PassBuilder::buildModuleOptimizationPipeline(OptimizationLevel Level,
   if (!LTOPreLink)
     MPM.addPass(RelLookupTableConverterPass());
 
+  if (PTO.DevirtualizeSpeculatively && LTOPhase == ThinOrFullLTOPhase::None) {
+    MPM.addPass(WholeProgramDevirtPass(
+        /*ExportSummary*/ nullptr,
+        /*ImportSummary*/ nullptr,
+        /*DevirtSpeculatively*/ PTO.DevirtualizeSpeculatively));
+    MPM.addPass(LowerTypeTestsPass(nullptr, nullptr,
+                                   lowertypetests::DropTestKind::Assume));
+    if (EnableModuleInliner) {
----------------
hassnaaHamdi wrote:

Okay, I see that integrating the WPD pass into another pipeline is non-trivial 
and would require changes across multiple places. Additionally, I'm uncertain 
if this approach will succeed given that WPD is a module pass.
Maybe (maybe) it could be better to have a different pass for non-to 
speculative devirtualization isolated from all the LTO stuff and in that case 
it's easier to add any needed changes into the pass without touching LTO 
things. 
But anyway, I'll need to investigate the suggested approach further before 
implementing.

Does it make sense to keep the current opt-in speculative devirtualization 
changes for now, and revisit the pipeline integration as a follow-up? 
Of course, I'm still open to pursuing the correct approach if the current 
implementation is not good enough.

https://github.com/llvm/llvm-project/pull/159685
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to