Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Handling maxval array function with comparision operator #5336

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Handled ArrayFunctions in array_op
  • Loading branch information
AnshMehta1 committed Nov 10, 2024
commit aebcb2878b155eb2fb019875c331cdd44e202737
32 changes: 24 additions & 8 deletions src/libasr/pass/array_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1475,16 +1475,32 @@ class ReplaceArrayOp: public ASR::BaseExprReplacer<ReplaceArrayOp> {
}

void replace_IntrinsicArrayFunction(ASR::IntrinsicArrayFunction_t* x) {
if(!ASRUtils::IntrinsicArrayFunctionRegistry::is_elemental(x->m_arr_intrinsic_id)) {
// ASR::BaseExprReplacer<ReplaceArrayOp>::replace_IntrinsicArrayFunction(x);
if( op_expr == &(x->base) ) {
op_dims = nullptr;
op_n_dims = ASRUtils::extract_dimensions_from_ttype(
ASRUtils::expr_type(*current_expr), op_dims);
if (op_expr == &(x->base)) {
op_dims = nullptr;
op_n_dims = ASRUtils::extract_dimensions_from_ttype(
ASRUtils::expr_type(*current_expr), op_dims);
}

for (size_t i = 0; i < x->n_args; i++){
ASR::expr_t* arg = x->m_args[i];

if (ASR::is_a<ASR::ArrayPhysicalCast_t>(*arg)) {
arg = ASR::down_cast<ASR::ArrayPhysicalCast_t>(arg)->m_arg;
}

if (ASR::is_a<ASR::IntrinsicElementalFunction_t>(*arg)) {
ASR::expr_t** current_expr_copy_9 = current_expr;
current_expr = &(x->m_args[i]);
ASR::dimension_t* op_dims_copy = op_dims;
size_t op_n_dims_copy = op_n_dims;
self().replace_expr(x->m_args[i]);
x->m_args[i] = *current_expr;
op_dims = op_dims_copy;
op_n_dims = op_n_dims_copy;
current_expr = current_expr_copy_9;
}
return ;
}
replace_intrinsic_function(x);
return ;
}

void replace_ArrayPhysicalCast(ASR::ArrayPhysicalCast_t* x) {
Expand Down
Loading