From f5f99f6e8a8825d138d3433c3a7cab8c25892cdf Mon Sep 17 00:00:00 2001 From: xnpster Date: Sun, 15 Jun 2025 15:08:11 +0300 Subject: [PATCH 1/2] REMOVE_DIST_ARRAYS_FROM_IO: improve parsing of IO operators, fix substitution borders --- .../replace_dist_arrays_in_io.cpp | 42 ++++++++++++------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp b/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp index f73e7c1..9a1ad21 100644 --- a/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp +++ b/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp @@ -88,24 +88,36 @@ static void populateDistributedIoArrays(map>& array case READ_STAT: case WRITE_STAT: { - SgExpression* spec = stat->expr(1); - __spf_print(DEBUG_TRACE, "[%d: %s (%d)]\n", 2000, spec->rhs()->unparse(), spec->rhs()->variant()); - if (!spec || spec->variant() != EXPR_LIST || - spec->lhs()->variant() != SPEC_PAIR || - !spec->rhs() || !spec->rhs()->lhs() || spec->rhs()->lhs()->variant() != SPEC_PAIR) + + if (spec->variant() == SPEC_PAIR) { - printInternalError(convertFileName(__FILE__).c_str(), __LINE__); - return; + if (spec->rhs()->variant() != KEYWORD_VAL || spec->rhs()->sunparse() != "*") + { + need_replace = true; + break; + } } + else + { + while (spec) + { + auto *kv = spec->lhs(); + if (!kv || kv->variant() != SPEC_PAIR || !kv->rhs()) + { + printInternalError(convertFileName(__FILE__).c_str(), __LINE__); + return; + } - SgExpression* unit_val = spec->lhs()->rhs(), * fmt_val = spec->rhs()->lhs()->rhs(); + if (kv->rhs()->variant() != KEYWORD_VAL || kv->rhs()->sunparse() != "*") + { + need_replace = true; + break; + } - if (unit_val->variant() != KEYWORD_VAL || unit_val->sunparse() != "*" || - fmt_val->variant() != KEYWORD_VAL || fmt_val->sunparse() != "*") - need_replace = true; - - break; + spec = spec->rhs(); + } + } } default: break; @@ -203,11 +215,9 @@ static void copyArrayBetweenStatements(SgSymbol* replace_symb, SgSymbol* replace while (start->lexNext() && !isSgExecutableStatement(start->lexNext())) start = start->lexNext(); - auto* stop = last->lexNext(); - bool has_read = false, has_write = false; - for (auto* st = start->lexNext(); st && st != stop->lexPrev(); st = st->lexNext()) + for (auto* st = start->lexNext(); st && st != last; st = st->lexNext()) replaceArrayRec(replace_symb, replace_by, st, has_read, has_write); -- 2.49.1 From 537f3eb6e92e1e1988f3eaafde73c7942685427d Mon Sep 17 00:00:00 2001 From: Alexander Date: Sun, 15 Jun 2025 20:06:35 +0300 Subject: [PATCH 2/2] version updated --- src/Utils/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Utils/version.h b/src/Utils/version.h index 4fc4e20..7465e56 100644 --- a/src/Utils/version.h +++ b/src/Utils/version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION_SPF "2428" +#define VERSION_SPF "2429" -- 2.49.1