[PATCH] D100802: [PassManager] add late LICM to LTO pipeline to undo InstCombine sinking

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 20 00:59:43 PDT 2021


lebedev.ri added a comment.

In D100802#2700532 <https://reviews.llvm.org/D100802#2700532>, @lebedev.ri wrote:

> I've kicked off https://llvm-compile-time-tracker.com/compare.php?from=0a671c48950a4e9ff962208837169ea077e39b51&to=9a88c0161d92413616c268abcc6f6a1b23873449&stat=instructions

https://llvm-compile-time-tracker.com/compare.php?from=9430efa18b02e7a3f453793e48c96d5c954ed751&to=9a88c0161d92413616c268abcc6f6a1b23873449&stat=instructions

So it's within the noise, except for +1% regression for full LTO.



================
Comment at: llvm/lib/Passes/PassBuilder.cpp:1843-1847
+  // LICM should always be run after the final InstCombine because InstCombine
+  // sinks instructions without regard to loop-invariance.
+  MainFPM.addPass(createFunctionToLoopPassAdaptor(
+      LICMPass(PTO.LicmMssaOptCap, PTO.LicmMssaNoAccForPromotionCap),
+      EnableMSSALoopDependency, /*UseBlockFrequencyInfo=*/true, DebugLogging));
----------------
Can you try something like this, ...


================
Comment at: llvm/lib/Passes/PassBuilder.cpp:1848
+      EnableMSSALoopDependency, /*UseBlockFrequencyInfo=*/true, DebugLogging));
   MPM.addPass(createModuleToFunctionPassAdaptor(std::move(MainFPM)));
 
----------------



================
Comment at: llvm/test/Other/opt-LTO-pipeline.ll:181
+; CHECK-NEXT:     Function Alias Analysis Results
+; CHECK-NEXT:     Memory SSA
+; CHECK-NEXT:     Natural Loop Information
----------------
This one is probably the most costly here.


================
Comment at: llvm/test/Other/opt-LTO-pipeline.ll:189
+; CHECK-NEXT:     Lazy Block Frequency Analysis
+; CHECK-NEXT:     Loop Pass Manager
+; CHECK-NEXT:       Loop Invariant Code Motion
----------------
..., i wonder if we could at least inline it into the `FunctionPass Manager` above


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D100802/new/

https://reviews.llvm.org/D100802



More information about the llvm-commits mailing list