From b71df882fb1d37b49351535534fd9b134943eeae Mon Sep 17 00:00:00 2001 From: xnpster Date: Sun, 12 Apr 2026 15:32:09 +0300 Subject: [PATCH 1/3] REMOVE_DIST_ARRAYS_FROM_IO: fix type, add TODO --- .../ReplaceArraysInIO/replace_dist_arrays_in_io.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp b/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp index c40bdba..5ac5afe 100644 --- a/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp +++ b/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp @@ -504,7 +504,7 @@ static void replaceArrayInFragment(SgSymbol* replace_symb, } } -static bool ioReginBorder(SgStatement* stat, SgStatement* last_io_bound) +static bool ioRegionBorder(SgStatement* stat, SgStatement* last_io_bound) { auto var = stat->variant(); @@ -535,8 +535,6 @@ static bool ioReginBorder(SgStatement* stat, SgStatement* last_io_bound) if (last_io_bound && last_io_bound->lastNodeOfStmt() && last_io_bound->lastNodeOfStmt() == stat) return true; - int parent_var; - if (var == CONTROL_END && border_stats.find(stat->controlParent()->variant()) != border_stats.end()) return true; @@ -602,6 +600,7 @@ void replaceDistributedArraysInIO(vector& regions, auto var = curr_stmt->variant(); + // TODO: does not work with user regions if (var == PROC_HEDR || var == PROG_HEDR || var == FUNC_HEDR) { current_func_info = NULL; @@ -628,7 +627,7 @@ void replaceDistributedArraysInIO(vector& regions, break; } - if (ioReginBorder(curr_stmt, last_io_bound)) + if (ioRegionBorder(curr_stmt, last_io_bound)) { for (const auto& by_array_to_copy : need_replace) { -- 2.49.1 From db5062c41663a6c157193581e19e7a96ee3a7ebe Mon Sep 17 00:00:00 2001 From: xnpster Date: Sun, 12 Apr 2026 15:32:09 +0300 Subject: [PATCH 2/3] REMOVE_DIST_ARRAYS_FROM_IO: find current FuncInfo properly --- .../replace_dist_arrays_in_io.cpp | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp b/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp index 5ac5afe..0989851 100644 --- a/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp +++ b/src/Transformations/ReplaceArraysInIO/replace_dist_arrays_in_io.cpp @@ -541,6 +541,18 @@ static bool ioRegionBorder(SgStatement* stat, SgStatement* last_io_bound) return false; } +FuncInfo* getCurrentFuncInfo(const vector& fileFuncInfo, int line) +{ + for (auto* func : fileFuncInfo) + { + if (func->linesNum.first <= line && line <= func->linesNum.second) + return func; + } + + printInternalError(convertFileName(__FILE__).c_str(), __LINE__); + return NULL; +} + void replaceDistributedArraysInIO(vector& regions, const map>& allFuncInfo, map>& SPF_messages, @@ -560,6 +572,8 @@ void replaceDistributedArraysInIO(vector& regions, if (SgFile::switchToFile(current_file_name) == -1) printInternalError(convertFileName(__FILE__).c_str(), __LINE__); + FuncInfo *current_func_info = NULL; + auto func_info_it = allFuncInfo.find(current_file_name); if (func_info_it == allFuncInfo.end()) printInternalError(convertFileName(__FILE__).c_str(), __LINE__); @@ -586,13 +600,12 @@ void replaceDistributedArraysInIO(vector& regions, { curr_stmt = lines.stats.first->GetOriginal(); end = lines.stats.second->GetOriginal()->lexNext(); + current_func_info = getCurrentFuncInfo(func_info_it->second, curr_stmt->lineNumber()); } map> need_replace; SgStatement* last_io_bound = NULL; - FuncInfo *current_func_info = NULL; - while (curr_stmt != end) { if (!curr_stmt) @@ -600,21 +613,9 @@ void replaceDistributedArraysInIO(vector& regions, auto var = curr_stmt->variant(); - // TODO: does not work with user regions if (var == PROC_HEDR || var == PROG_HEDR || var == FUNC_HEDR) { - current_func_info = NULL; - for (auto *func_info : func_info_it->second) - { - if (func_info->funcName == curr_stmt->symbol()->identifier()) - { - current_func_info = func_info; - break; - } - } - - if (!current_func_info) - printInternalError(convertFileName(__FILE__).c_str(), __LINE__); + current_func_info = getCurrentFuncInfo(func_info_it->second, curr_stmt->lineNumber()); curr_stmt = curr_stmt->lexNext(); while (curr_stmt && !isSgExecutableStatement(curr_stmt)) -- 2.49.1 From a8ddc94734721ae4492b3256c51e19d1d6e46b0a Mon Sep 17 00:00:00 2001 From: ALEXks Date: Sun, 12 Apr 2026 20:16:23 +0300 Subject: [PATCH 3/3] 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 f4e1cca..4eb8abe 100644 --- a/src/Utils/version.h +++ b/src/Utils/version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION_SPF "2475" +#define VERSION_SPF "2476" -- 2.49.1