Skip to content

Commit 44c6b96

Browse files
authored
Merge pull request #2600 from czgdp1807/fast_fix
Remove ``is_fast`` and its associated methods from ``PassManager``
2 parents 3e6ddc6 + 70aaf07 commit 44c6b96

File tree

6 files changed

+13
-17
lines changed

6 files changed

+13
-17
lines changed

run_tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def is_included(backend):
3232
run = is_included("run")
3333
run_with_dbg = is_included("run_with_dbg")
3434
disable_main = is_included("disable_main")
35+
fast = is_included("fast")
3536
pass_ = test.get("pass", None)
3637
optimization_passes = ["flip_sign", "div_to_mul", "fma", "sign_from_value",
3738
"inline_function_calls", "loop_unroll",
@@ -97,6 +98,8 @@ def is_included(backend):
9798
cmd = "lpython "
9899
if is_cumulative:
99100
cmd += "--cumulative "
101+
if fast:
102+
cmd += "--fast "
100103
cmd += "--pass=" + pass_ + \
101104
" --show-asr --no-color {infile} -o {outfile}"
102105
run_test(filename, "pass_{}".format(pass_), cmd,

src/bin/lpython.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1691,7 +1691,10 @@ int main(int argc, char *argv[])
16911691
// ReleaseSafe Mode
16921692
} else if ( compiler_options.po.fast ) {
16931693
// Release Mode
1694-
lpython_pass_manager.use_optimization_passes();
1694+
// No need to do anything, compiler_options.po.fast
1695+
// sends the signal to pass_manager when passes are applied
1696+
// Earlier it was redundant to call `use_optimisation_passes`
1697+
// which is now removed
16951698
} else {
16961699
// Debug Mode
16971700
compiler_options.enable_bounds_checking = true;

src/libasr/pass/pass_manager.h

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ namespace LCompilers {
106106
{"insert_deallocate", &pass_insert_deallocate}
107107
};
108108

109-
bool is_fast;
110109
bool apply_default_passes;
111110
bool c_skip_pass; // This will contain the passes that are to be skipped in C
112111

@@ -196,7 +195,7 @@ namespace LCompilers {
196195
}
197196
}
198197

199-
PassManager(): is_fast{false}, apply_default_passes{false},
198+
PassManager(): apply_default_passes{false},
200199
c_skip_pass{false} {
201200
_passes = {
202201
"nested_vars",
@@ -287,12 +286,10 @@ namespace LCompilers {
287286
PassOptions& pass_options,
288287
diag::Diagnostics &diagnostics) {
289288
if( !_user_defined_passes.empty() ) {
290-
pass_options.fast = true;
291289
apply_passes(al, asr, _user_defined_passes, pass_options,
292290
diagnostics);
293291
} else if( apply_default_passes ) {
294-
pass_options.fast = is_fast;
295-
if( is_fast ) {
292+
if( pass_options.fast ) {
296293
apply_passes(al, asr, _with_optimization_passes, pass_options,
297294
diagnostics);
298295
} else {
@@ -371,14 +368,6 @@ namespace LCompilers {
371368
}
372369
}
373370

374-
void use_optimization_passes() {
375-
is_fast = true;
376-
}
377-
378-
void do_not_use_optimization_passes() {
379-
is_fast = false;
380-
}
381-
382371
void use_default_passes(bool _c_skip_pass=false) {
383372
apply_default_passes = true;
384373
c_skip_pass = _c_skip_pass;

tests/reference/pass_inline_function_calls-func_inline_01-8b6a5da.json renamed to tests/reference/pass_inline_function_calls-func_inline_01-fba3c47.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"basename": "pass_inline_function_calls-func_inline_01-8b6a5da",
3-
"cmd": "lpython --pass=inline_function_calls --show-asr --no-color {infile} -o {outfile}",
2+
"basename": "pass_inline_function_calls-func_inline_01-fba3c47",
3+
"cmd": "lpython --fast --pass=inline_function_calls --show-asr --no-color {infile} -o {outfile}",
44
"infile": "tests/../integration_tests/func_inline_01.py",
55
"infile_hash": "65a2e9a9bc7ad68a5e104549eed00cafd02b643a1d91ab2e175b2198",
66
"outfile": null,
77
"outfile_hash": null,
8-
"stdout": "pass_inline_function_calls-func_inline_01-8b6a5da.stdout",
8+
"stdout": "pass_inline_function_calls-func_inline_01-fba3c47.stdout",
99
"stdout_hash": "1705050e9a2183a2f6aa493125e093e7c4d17a4f2f4949749950e11a",
1010
"stderr": null,
1111
"stderr_hash": null,

tests/reference/pass_inline_function_calls-func_inline_01-8b6a5da.stdout renamed to tests/reference/pass_inline_function_calls-func_inline_01-fba3c47.stdout

File renamed without changes.

tests/tests.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ asr = true
228228
llvm = true
229229
pass_with_llvm = true
230230
pass = "inline_function_calls"
231+
fast = true
231232

232233
# to make sure static keyword is actually present in function declaration
233234
[[test]]

0 commit comments

Comments
 (0)