[flang-commits] [flang] [Flang] Add opt-in affine loop optimization pipeline (PR #191854)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Tue Apr 14 04:33:59 PDT 2026
================
@@ -191,6 +194,54 @@ void createDefaultFIROptimizerPassPipeline(mlir::PassManager &pm,
config.setRegionSimplificationLevel(
mlir::GreedySimplifyRegionLevel::Disabled);
pm.addPass(mlir::createCSEPass());
+
+ // Affine loop optimization pipeline (opt-in via --enable-affine-loop-opt).
+ if (enableAffineLoopOpt) {
+ pm.addPass(mlir::createCanonicalizerPass(config));
+ pm.addPass(mlir::createCSEPass());
+
+ addNestedPassToAllTopLevelOperations<PassConstructor>(
+ pm, fir::createSimplifyDoLoopPass);
+
+ pm.addPass(mlir::createCanonicalizerPass(config));
+ pm.addPass(mlir::createCSEPass());
+
+ pm.addPass(mlir::createLoopInvariantCodeMotionPass());
+ pm.addPass(fir::createLoopInvariantCodeMotion());
----------------
tblah wrote:
Wouldn't it be better to do LICM before SimplifyDoLoopPass so that SimplifyDoLoopPass is operating on a loop which is as simple as we can make it?
https://github.com/llvm/llvm-project/pull/191854
More information about the flang-commits
mailing list