From 94662245d7cd01af63f6a3d91af9ba3cf6d516f0 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 13 Mar 2024 23:47:39 +0530 Subject: [PATCH 1/5] DEV: Removed is_fast and its associated methods --- src/libasr/pass/pass_manager.h | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/libasr/pass/pass_manager.h b/src/libasr/pass/pass_manager.h index 70a449e1ae..2b078cc955 100644 --- a/src/libasr/pass/pass_manager.h +++ b/src/libasr/pass/pass_manager.h @@ -106,7 +106,6 @@ namespace LCompilers { {"insert_deallocate", &pass_insert_deallocate} }; - bool is_fast; bool apply_default_passes; bool c_skip_pass; // This will contain the passes that are to be skipped in C @@ -196,7 +195,7 @@ namespace LCompilers { } } - PassManager(): is_fast{false}, apply_default_passes{false}, + PassManager(): apply_default_passes{false}, c_skip_pass{false} { _passes = { "nested_vars", @@ -287,12 +286,10 @@ namespace LCompilers { PassOptions& pass_options, diag::Diagnostics &diagnostics) { if( !_user_defined_passes.empty() ) { - pass_options.fast = true; apply_passes(al, asr, _user_defined_passes, pass_options, diagnostics); } else if( apply_default_passes ) { - pass_options.fast = is_fast; - if( is_fast ) { + if( pass_options.fast ) { apply_passes(al, asr, _with_optimization_passes, pass_options, diagnostics); } else { @@ -371,14 +368,6 @@ namespace LCompilers { } } - void use_optimization_passes() { - is_fast = true; - } - - void do_not_use_optimization_passes() { - is_fast = false; - } - void use_default_passes(bool _c_skip_pass=false) { apply_default_passes = true; c_skip_pass = _c_skip_pass; From 6881e80e99d444b2a115c73901532ab8a1de02ad Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 13 Mar 2024 23:47:56 +0530 Subject: [PATCH 2/5] DEV: Remove usage of non-existent functions --- src/bin/lpython.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bin/lpython.cpp b/src/bin/lpython.cpp index f03081eb1a..b722ed7a8f 100644 --- a/src/bin/lpython.cpp +++ b/src/bin/lpython.cpp @@ -1691,7 +1691,10 @@ int main(int argc, char *argv[]) // ReleaseSafe Mode } else if ( compiler_options.po.fast ) { // Release Mode - lpython_pass_manager.use_optimization_passes(); + // No need to do anything, compiler_options.po.fast + // sends the signal to pass_manager when passes are applied + // Earlier it was redundant to call `use_optimisation_passes` + // which is now removed } else { // Debug Mode compiler_options.enable_bounds_checking = true; From 5dd4f8eb79dbd14cbe3064bd5d9273b271422203 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 13 Mar 2024 23:48:21 +0530 Subject: [PATCH 3/5] TEST: Add processing of fast tag in tests.toml file --- run_tests.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/run_tests.py b/run_tests.py index e6df77d805..1bd2a0c51b 100755 --- a/run_tests.py +++ b/run_tests.py @@ -32,6 +32,7 @@ def is_included(backend): run = is_included("run") run_with_dbg = is_included("run_with_dbg") disable_main = is_included("disable_main") + fast = is_included("fast") pass_ = test.get("pass", None) optimization_passes = ["flip_sign", "div_to_mul", "fma", "sign_from_value", "inline_function_calls", "loop_unroll", @@ -97,6 +98,8 @@ def is_included(backend): cmd = "lpython " if is_cumulative: cmd += "--cumulative " + if fast: + cmd += "--fast " cmd += "--pass=" + pass_ + \ " --show-asr --no-color {infile} -o {outfile}" run_test(filename, "pass_{}".format(pass_), cmd, From ab4425af4a4b42f9de090f69b517f15ab5e8c34d Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 13 Mar 2024 23:48:43 +0530 Subject: [PATCH 4/5] TEST: Set fast=true for inline_function_calls --- tests/tests.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/tests.toml b/tests/tests.toml index bc1a4d6fcb..2691050814 100644 --- a/tests/tests.toml +++ b/tests/tests.toml @@ -228,6 +228,7 @@ asr = true llvm = true pass_with_llvm = true pass = "inline_function_calls" +fast = true # to make sure static keyword is actually present in function declaration [[test]] From 70aaf075461727c42e3423354fafc14f043cbf73 Mon Sep 17 00:00:00 2001 From: Gagandeep Singh Date: Wed, 13 Mar 2024 23:49:00 +0530 Subject: [PATCH 5/5] TEST: Updated reference tests --- ... pass_inline_function_calls-func_inline_01-fba3c47.json} | 6 +++--- ...ass_inline_function_calls-func_inline_01-fba3c47.stdout} | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename tests/reference/{pass_inline_function_calls-func_inline_01-8b6a5da.json => pass_inline_function_calls-func_inline_01-fba3c47.json} (59%) rename tests/reference/{pass_inline_function_calls-func_inline_01-8b6a5da.stdout => pass_inline_function_calls-func_inline_01-fba3c47.stdout} (100%) diff --git a/tests/reference/pass_inline_function_calls-func_inline_01-8b6a5da.json b/tests/reference/pass_inline_function_calls-func_inline_01-fba3c47.json similarity index 59% rename from tests/reference/pass_inline_function_calls-func_inline_01-8b6a5da.json rename to tests/reference/pass_inline_function_calls-func_inline_01-fba3c47.json index bb2bbf2c49..447a7b2cdf 100644 --- a/tests/reference/pass_inline_function_calls-func_inline_01-8b6a5da.json +++ b/tests/reference/pass_inline_function_calls-func_inline_01-fba3c47.json @@ -1,11 +1,11 @@ { - "basename": "pass_inline_function_calls-func_inline_01-8b6a5da", - "cmd": "lpython --pass=inline_function_calls --show-asr --no-color {infile} -o {outfile}", + "basename": "pass_inline_function_calls-func_inline_01-fba3c47", + "cmd": "lpython --fast --pass=inline_function_calls --show-asr --no-color {infile} -o {outfile}", "infile": "tests/../integration_tests/func_inline_01.py", "infile_hash": "65a2e9a9bc7ad68a5e104549eed00cafd02b643a1d91ab2e175b2198", "outfile": null, "outfile_hash": null, - "stdout": "pass_inline_function_calls-func_inline_01-8b6a5da.stdout", + "stdout": "pass_inline_function_calls-func_inline_01-fba3c47.stdout", "stdout_hash": "1705050e9a2183a2f6aa493125e093e7c4d17a4f2f4949749950e11a", "stderr": null, "stderr_hash": null, diff --git a/tests/reference/pass_inline_function_calls-func_inline_01-8b6a5da.stdout b/tests/reference/pass_inline_function_calls-func_inline_01-fba3c47.stdout similarity index 100% rename from tests/reference/pass_inline_function_calls-func_inline_01-8b6a5da.stdout rename to tests/reference/pass_inline_function_calls-func_inline_01-fba3c47.stdout