Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
flang/include/flang/Tools/CLOptions.inc
Show First 20 Lines • Show All 150 Lines • ▼ Show 20 Lines | addPassConditionally(pm, disableExternalNameConversion, | ||||
[&]() { return fir::createExternalNameConversionPass(); }); | [&]() { return fir::createExternalNameConversionPass(); }); | ||||
} | } | ||||
/// Create a pass pipeline for running default optimization passes for | /// Create a pass pipeline for running default optimization passes for | ||||
/// incremental conversion of FIR. | /// incremental conversion of FIR. | ||||
/// | /// | ||||
/// \param pm - MLIR pass manager that will hold the pipeline definition | /// \param pm - MLIR pass manager that will hold the pipeline definition | ||||
inline void createDefaultFIROptimizerPassPipeline( | inline void createDefaultFIROptimizerPassPipeline( | ||||
mlir::PassManager &pm, llvm::OptimizationLevel optLevel = defaultOptLevel) { | mlir::PassManager &pm, bool stackArrays = false, llvm::OptimizationLevel optLevel = defaultOptLevel) { | ||||
awarzynski: CLANG-FORMAT-ME :) Same for other long lines here. | |||||
tblahAuthorUnsubmitted It seems clang-format is not run on this file. I have fixed the lines changed in my patch. Should I clang-format the whole file in a separate patch? tblah: It seems clang-format is not run on this file. I have fixed the lines changed in my patch. | |||||
awarzynskiUnsubmitted +1 awarzynski: +1 | |||||
// simplify the IR | // simplify the IR | ||||
mlir::GreedyRewriteConfig config; | mlir::GreedyRewriteConfig config; | ||||
config.enableRegionSimplification = false; | config.enableRegionSimplification = false; | ||||
pm.addPass(mlir::createCSEPass()); | pm.addPass(mlir::createCSEPass()); | ||||
fir::addAVC(pm); | fir::addAVC(pm); | ||||
pm.addNestedPass<mlir::func::FuncOp>(fir::createCharacterConversionPass()); | pm.addNestedPass<mlir::func::FuncOp>(fir::createCharacterConversionPass()); | ||||
pm.addPass(mlir::createCanonicalizerPass(config)); | pm.addPass(mlir::createCanonicalizerPass(config)); | ||||
pm.addPass(fir::createSimplifyRegionLitePass()); | pm.addPass(fir::createSimplifyRegionLitePass()); | ||||
if (optLevel.isOptimizingForSpeed()) { | if (optLevel.isOptimizingForSpeed()) { | ||||
// These passes may increase code size. | // These passes may increase code size. | ||||
pm.addPass(fir::createSimplifyIntrinsicsPass()); | pm.addPass(fir::createSimplifyIntrinsicsPass()); | ||||
pm.addPass(fir::createAlgebraicSimplificationPass(config)); | pm.addPass(fir::createAlgebraicSimplificationPass(config)); | ||||
} | } | ||||
pm.addPass(mlir::createCSEPass()); | pm.addPass(mlir::createCSEPass()); | ||||
if (stackArrays) | |||||
pm.addPass(fir::createStackArraysPass()); | |||||
else | |||||
fir::addMemoryAllocationOpt(pm); | fir::addMemoryAllocationOpt(pm); | ||||
// The default inliner pass adds the canonicalizer pass with the default | // The default inliner pass adds the canonicalizer pass with the default | ||||
// configuration. Create the inliner pass with tco config. | // configuration. Create the inliner pass with tco config. | ||||
llvm::StringMap<mlir::OpPassManager> pipelines; | llvm::StringMap<mlir::OpPassManager> pipelines; | ||||
pm.addPass( | pm.addPass( | ||||
mlir::createInlinerPass(pipelines, defaultFlangInlinerOptPipeline)); | mlir::createInlinerPass(pipelines, defaultFlangInlinerOptPipeline)); | ||||
pm.addPass(fir::createSimplifyRegionLitePass()); | pm.addPass(fir::createSimplifyRegionLitePass()); | ||||
pm.addPass(mlir::createCSEPass()); | pm.addPass(mlir::createCSEPass()); | ||||
Show All 21 Lines | |||||
} | } | ||||
/// Create a pass pipeline for lowering from MLIR to LLVM IR | /// Create a pass pipeline for lowering from MLIR to LLVM IR | ||||
/// | /// | ||||
/// \param pm - MLIR pass manager that will hold the pipeline definition | /// \param pm - MLIR pass manager that will hold the pipeline definition | ||||
/// \param optLevel - optimization level used for creating FIR optimization | /// \param optLevel - optimization level used for creating FIR optimization | ||||
/// passes pipeline | /// passes pipeline | ||||
inline void createMLIRToLLVMPassPipeline( | inline void createMLIRToLLVMPassPipeline( | ||||
mlir::PassManager &pm, llvm::OptimizationLevel optLevel = defaultOptLevel) { | mlir::PassManager &pm, bool stackArrays = false, llvm::OptimizationLevel optLevel = defaultOptLevel) { | ||||
awarzynskiUnsubmitted [nit] To me, it would make more sense to put stackArrays at the end. optLevelis a more powerful flag. awarzynski: [nit] To me, it would make more sense to put `stackArrays` at the end. `optLevel`is a more… | |||||
// Add default optimizer pass pipeline. | // Add default optimizer pass pipeline. | ||||
fir::createDefaultFIROptimizerPassPipeline(pm, optLevel); | fir::createDefaultFIROptimizerPassPipeline(pm, stackArrays, optLevel); | ||||
// Add codegen pass pipeline. | // Add codegen pass pipeline. | ||||
fir::createDefaultFIRCodeGenPassPipeline(pm); | fir::createDefaultFIRCodeGenPassPipeline(pm); | ||||
} | } | ||||
#undef FLANG_EXCLUDE_CODEGEN | #undef FLANG_EXCLUDE_CODEGEN | ||||
#endif | #endif | ||||
} // namespace fir | } // namespace fir |
CLANG-FORMAT-ME :) Same for other long lines here.