REMOVE_DIST_ARRAYS_FROM_IO: consider write/read statements with nested loops

This commit is contained in:
2025-10-01 19:48:34 +03:00
committed by Egor Mayorov
parent afc88bf056
commit 641e68d748

View File

@@ -17,6 +17,14 @@ using std::pair;
#define DEBUG_TRACE 0
static bool hasArrayRef(SgExpression* ex)
{
if (ex)
return isArrayRef(ex) || hasArrayRef(ex->lhs()) || hasArrayRef(ex->rhs());
return false;
}
static inline bool isArrayDeclaration(SgStatement* st)
{
return isSgDeclarationStatement(st) || isSgVarListDeclStmt(st) || isSgNestedVarListDeclStmt(st);
@@ -201,11 +209,15 @@ static bool populateDistributedIoArrays(map<SgSymbol*, set<SgStatement*>>& array
if (!arg)
return false;
if (!isArrayRef(arg))
if (hasArrayRef(arg))
{
if (isArrayRef(arg) && arg->lhs())
need_replace = true;
}
else
{
return false;
if (arg->lhs())
need_replace = true;
}
}
else
{