[flang-commits] [flang] ee0166c - [flang] Enable SimplifyIntrinsics pass in driver.

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Thu Aug 18 08:56:07 PDT 2022


Author: Slava Zakharin
Date: 2022-08-18T08:55:27-07:00
New Revision: ee0166cfc5a88e57d5b9b51a83640e7902041541

URL: https://github.com/llvm/llvm-project/commit/ee0166cfc5a88e57d5b9b51a83640e7902041541
DIFF: https://github.com/llvm/llvm-project/commit/ee0166cfc5a88e57d5b9b51a83640e7902041541.diff

LOG: [flang] Enable SimplifyIntrinsics pass in driver.

The pass is enabled for O1/O2/O3 optlevels now.

Differential Revision: https://reviews.llvm.org/D132069

Added: 
    

Modified: 
    flang/include/flang/Tools/CLOptions.inc
    flang/test/Driver/bbc-mlir-pass-pipeline.f90
    flang/test/Driver/mlir-pass-pipeline.f90
    flang/test/Fir/basic-program.fir

Removed: 
    


################################################################################
diff  --git a/flang/include/flang/Tools/CLOptions.inc b/flang/include/flang/Tools/CLOptions.inc
index 97bdddbfc38ab..ec79902125f55 100644
--- a/flang/include/flang/Tools/CLOptions.inc
+++ b/flang/include/flang/Tools/CLOptions.inc
@@ -165,9 +165,11 @@ inline void createDefaultFIROptimizerPassPipeline(
   pm.addNestedPass<mlir::func::FuncOp>(fir::createCharacterConversionPass());
   pm.addPass(mlir::createCanonicalizerPass(config));
   pm.addPass(fir::createSimplifyRegionLitePass());
-  // Algebraic simplifications may increase code size.
-  if (optLevel.isOptimizingForSpeed())
+  if (optLevel.isOptimizingForSpeed()) {
+    // These passes may increase code size.
+    pm.addPass(fir::createSimplifyIntrinsicsPass());
     pm.addPass(fir::createAlgebraicSimplificationPass(config));
+  }
   pm.addPass(mlir::createCSEPass());
   fir::addMemoryAllocationOpt(pm);
 

diff  --git a/flang/test/Driver/bbc-mlir-pass-pipeline.f90 b/flang/test/Driver/bbc-mlir-pass-pipeline.f90
index 388cc0574145d..c71c36a18cf36 100644
--- a/flang/test/Driver/bbc-mlir-pass-pipeline.f90
+++ b/flang/test/Driver/bbc-mlir-pass-pipeline.f90
@@ -23,6 +23,7 @@
 
 ! CHECK-NEXT: Canonicalizer
 ! CHECK-NEXT: SimplifyRegionLite
+! CHECK-NEXT: SimplifyIntrinsics
 ! CHECK-NEXT: AlgebraicSimplification
 ! CHECK-NEXT: CSE
 ! CHECK-NEXT:   (S) 0 num-cse'd - Number of operations CSE'd

diff  --git a/flang/test/Driver/mlir-pass-pipeline.f90 b/flang/test/Driver/mlir-pass-pipeline.f90
index ac70f0576892b..17b9c0c495e7c 100644
--- a/flang/test/Driver/mlir-pass-pipeline.f90
+++ b/flang/test/Driver/mlir-pass-pipeline.f90
@@ -26,6 +26,7 @@
 
 ! ALL-NEXT: Canonicalizer
 ! ALL-NEXT: SimplifyRegionLite
+!  O2-NEXT: SimplifyIntrinsics
 !  O2-NEXT: AlgebraicSimplification
 ! ALL-NEXT: CSE
 ! ALL-NEXT:   (S) 0 num-cse'd - Number of operations CSE'd

diff  --git a/flang/test/Fir/basic-program.fir b/flang/test/Fir/basic-program.fir
index 7501f82b90175..94b264cf584c2 100644
--- a/flang/test/Fir/basic-program.fir
+++ b/flang/test/Fir/basic-program.fir
@@ -26,6 +26,7 @@ func.func @_QQmain() {
 
 // PASSES-NEXT: Canonicalizer
 // PASSES-NEXT: SimplifyRegionLite
+// PASSES-NEXT: SimplifyIntrinsics
 // PASSES-NEXT: AlgebraicSimplification
 // PASSES-NEXT: CSE
 // PASSES-NEXT:   (S) 0 num-cse'd - Number of operations CSE'd


        


More information about the flang-commits mailing list