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

Tom Eccles via flang-commits flang-commits at lists.llvm.org
Fri Jan 2 03:57:23 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());
----------------
tblah wrote:

Thanks.

I'm not really opposed to having this on by default so long as you don't find serious compilation time regressions (I agree this pass looks useful in the long term), but feel free to disable by default for now if you prefer.

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


More information about the flang-commits mailing list