Skip to content

Commit 07db35c

Browse files
committed
Respect inline decorator in normal compilation
1 parent 78a008d commit 07db35c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/libasr/pass/inline_function_calls.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class InlineFunctionCallVisitor : public PassUtils::PassVisitor<InlineFunctionCa
4545

4646
bool from_inline_function_call, inlining_function;
4747
bool fixed_duplicated_expr_stmt;
48+
bool is_fast;
4849

4950
// Stores the local variables corresponding to the ones
5051
// present in function symbol table.
@@ -66,10 +67,12 @@ class InlineFunctionCallVisitor : public PassUtils::PassVisitor<InlineFunctionCa
6667

6768
bool function_inlined;
6869

69-
InlineFunctionCallVisitor(Allocator &al_, const std::string& rl_path_, bool inline_external_symbol_calls_)
70+
InlineFunctionCallVisitor(Allocator &al_, const std::string& rl_path_,
71+
bool inline_external_symbol_calls_, bool is_fast_)
7072
: PassVisitor(al_, nullptr),
7173
rl_path(rl_path_), function_result_var(nullptr),
7274
from_inline_function_call(false), inlining_function(false), fixed_duplicated_expr_stmt(false),
75+
is_fast(is_fast_),
7376
current_routine(""), inline_external_symbol_calls(inline_external_symbol_calls_),
7477
node_duplicator(al_), current_routine_scope(nullptr),
7578
label_generator(ASRUtils::LabelGenerator::get_instance()),
@@ -211,6 +214,10 @@ class InlineFunctionCallVisitor : public PassUtils::PassVisitor<InlineFunctionCa
211214
return ;
212215
}
213216

217+
if( !is_fast && !func->m_inline ) {
218+
return ;
219+
}
220+
214221
current_routine_scope = func->m_symtab;
215222

216223
ASR::expr_t* return_var = nullptr;
@@ -448,7 +455,7 @@ void pass_inline_function_calls(Allocator &al, ASR::TranslationUnit_t &unit,
448455
const LCompilers::PassOptions& pass_options) {
449456
std::string rl_path = pass_options.runtime_library_dir;
450457
bool inline_external_symbol_calls = pass_options.inline_external_symbol_calls;
451-
InlineFunctionCallVisitor v(al, rl_path, inline_external_symbol_calls);
458+
InlineFunctionCallVisitor v(al, rl_path, inline_external_symbol_calls, pass_options.fast);
452459
v.configure_node_duplicator(false);
453460
v.visit_TranslationUnit(unit);
454461
v.configure_node_duplicator(true);

0 commit comments

Comments
 (0)