From c6f1452c91397afec1606b9ddf23d02ee511e8e5 Mon Sep 17 00:00:00 2001 From: Shaikh Ubaid Date: Thu, 7 Sep 2023 08:49:02 +0530 Subject: [PATCH] changes from lfortran --- src/libasr/pass/intrinsic_function.cpp | 31 ++++++++------------------ 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/src/libasr/pass/intrinsic_function.cpp b/src/libasr/pass/intrinsic_function.cpp index f39c1927ed..4518abf89b 100644 --- a/src/libasr/pass/intrinsic_function.cpp +++ b/src/libasr/pass/intrinsic_function.cpp @@ -75,12 +75,7 @@ class ReplaceIntrinsicFunctions: public ASR::BaseExprReplacerbase.base.loc, global_scope, arg_types, x->m_type, new_args, x->m_overload_id); - if( ASR::is_a(*(*current_expr)) ) { - ASR::ArrayPhysicalCast_t* array_physical_cast_t = ASR::down_cast(*current_expr); - array_physical_cast_t->m_arg = current_expr_; - } else { - *current_expr = current_expr_; - } + *current_expr = current_expr_; } void replace_IntrinsicArrayFunction(ASR::IntrinsicArrayFunction_t* x) { @@ -120,12 +115,7 @@ class ReplaceIntrinsicFunctions: public ASR::BaseExprReplacerbase.base.loc, global_scope, arg_types, x->m_type, new_args, x->m_overload_id); ASR::expr_t* func_call = current_expr_; - if( ASR::is_a(*(*current_expr)) ) { - ASR::ArrayPhysicalCast_t* array_physical_cast_t = ASR::down_cast(*current_expr); - array_physical_cast_t->m_arg = current_expr_; - } else { - *current_expr = current_expr_; - } + *current_expr = current_expr_; if (ASR::is_a(*func_call)) { ASR::symbol_t *call_sym = ASRUtils::symbol_get_past_external( ASR::down_cast(func_call)->m_name); @@ -287,7 +277,7 @@ class ReplaceFunctionCallReturningArray: public ASR::BaseExprReplacerm_args[dim_index].m_value; if( !ASRUtils::is_value_constant(ASRUtils::expr_value(dim)) ) { // Possibly can be replaced by calling "get_result_var_for_runtime_dim" @@ -302,6 +292,12 @@ class ReplaceFunctionCallReturningArray: public ASR::BaseExprReplacerm_name)) + "_res", + x->base.base.loc, x->m_type, al, current_scope); + } else { + LCOMPILERS_ASSERT(false); } result_counter += 1; ASR::call_arg_t new_arg; @@ -366,15 +362,6 @@ class ReplaceFunctionCallReturningArrayVisitor : public ASR::CallReplacerOnExpre pass_result.n = 0; } - void visit_Assignment(const ASR::Assignment_t& x) { - ASR::CallReplacerOnExpressionsVisitor< - ReplaceFunctionCallReturningArrayVisitor>::visit_Assignment(x); - ASR::Assignment_t& xx = const_cast(x); - if( ASR::is_a(*x.m_value) ) { - xx.m_value = ASR::down_cast(x.m_value)->m_arg; - } - } - }; void pass_replace_intrinsic_function(Allocator &al, ASR::TranslationUnit_t &unit,