Skip to content

Commit

Permalink
Make single valued induction elimination optional
Browse files Browse the repository at this point in the history
  • Loading branch information
mscuttari committed Oct 5, 2024
1 parent 2c7f9e7 commit 55624fa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/public/marco/Frontend/CodegenOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace marco::frontend
bool cse = false;
bool equationsRuntimeScheduling = false;
bool omp = false;
bool singleValuedInductionElimination = false;
bool loopFusion = false;
bool loopCoalescing = false;
bool loopTiling = false;
Expand Down
2 changes: 2 additions & 0 deletions lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@ static void parseCodegenArgs(marco::frontend::CodegenOptions &options,
if (options.optLevel.getSpeedupLevel() > 0) {
options.debug = false;
options.assertions = false;
options.singleValuedInductionElimination = true;
}

if (options.optLevel.getSpeedupLevel() > 1) {
Expand All @@ -525,6 +526,7 @@ static void parseCodegenArgs(marco::frontend::CodegenOptions &options,
if (options.optLevel.getSizeLevel() > 0) {
options.debug = false;
options.cse = true;
options.singleValuedInductionElimination = true;
options.loopFusion = true;
options.loopCoalescing = true;
}
Expand Down
11 changes: 9 additions & 2 deletions lib/Frontend/FrontendActions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,11 @@ void CodeGenAction::buildMLIRLoweringPipeline(mlir::PassManager &pm) {
pm.addPass(mlir::createCanonicalizerPass());
pm.addPass(mlir::bmodelica::createMatchingPass());
pm.addPass(mlir::bmodelica::createEquationAccessSplitPass());
pm.addPass(mlir::bmodelica::createSingleValuedInductionEliminationPass());

if (ci.getCodeGenOptions().singleValuedInductionElimination) {
pm.addPass(mlir::bmodelica::createSingleValuedInductionEliminationPass());
}

pm.addPass(mlir::bmodelica::createSCCDetectionPass());

if (ci.getCodeGenOptions().variablesToParametersPromotion) {
Expand All @@ -837,7 +841,10 @@ void CodeGenAction::buildMLIRLoweringPipeline(mlir::PassManager &pm) {
// Simplify the possibly complex accesses introduced by equations
// substitutions.
pm.addPass(mlir::createCanonicalizerPass());
pm.addPass(mlir::bmodelica::createSingleValuedInductionEliminationPass());

if (ci.getCodeGenOptions().singleValuedInductionElimination) {
pm.addPass(mlir::bmodelica::createSingleValuedInductionEliminationPass());
}

// Apply the selected solver.
pm.addPass(
Expand Down

0 comments on commit 55624fa

Please sign in to comment.