[flang-commits] [flang] [flang] Added LoopInvariantCodeMotion pass for [HL]FIR. (PR #173438)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Mon Jan 5 08:51:32 PST 2026


================
@@ -206,6 +206,10 @@ void createDefaultFIROptimizerPassPipeline(mlir::PassManager &pm,
   pm.addPass(fir::createSimplifyRegionLite());
   pm.addPass(mlir::createCSEPass());
 
+  // Run LICM after CSE, which may reduce the number of operations to hoist.
+  if (pc.OptLevel.isOptimizingForSpeed())
+    pm.addPass(fir::createLoopInvariantCodeMotion());
----------------
vzakhari wrote:

I ran SPEC, polyhedron and some other apps with LICM enabled by default, and saw some fluctuations within about 6% range, but they did not reproduce on reruns. The builds of the files are done in parallel, so I am not sure how representative this testing is. On the other hand, it looks like there is no major regressions, otherwise, they would have shown up somehow. Anyway, I am still going to disable it by default for the time being.

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


More information about the flang-commits mailing list