add ddot, change array propagation

This commit is contained in:
2026-03-12 04:25:45 +03:00
committed by ALEXks
parent 39abbafb3a
commit 97e60e16be
3 changed files with 175 additions and 139 deletions

View File

@@ -33,10 +33,9 @@ static void RemoveEmptyPoints(ArrayAccessingIndexes& container)
points.push_back(arrayPoint);
}
if (points.size() < accessingSet.GetElements().size() && !points.empty())
if (!points.empty())
resultContainer[arrayName] = points;
if (points.empty())
else
toRemove.insert(arrayName);
}
@@ -281,7 +280,6 @@ static void SolveDataFlow(Region* DFG)
static bool getArrayDeclaredDimensions(SgArrayRefExp* arrayRef, vector<uint64_t>& declaredDims)
{
declaredDims.clear();
if (!arrayRef || !arrayRef->symbol() || !isSgArrayType(arrayRef->symbol()->type()))
return false;
SgArrayType* arrayType = (SgArrayType*)arrayRef->symbol()->type();
@@ -290,17 +288,22 @@ static bool getArrayDeclaredDimensions(SgArrayRefExp* arrayRef, vector<uint64_t>
{
SgExpression* sizeExpr = arrayType->sizeInDim(i);
SgConstantSymb* constValSymb = isSgConstantSymb(sizeExpr->symbol());
string strDimLength;
SgSubscriptExp* subscriptExpr = isSgSubscriptExp(sizeExpr);
uint64_t dimLength;
if (sizeExpr && sizeExpr->variant() == INT_VAL)
strDimLength = sizeExpr->unparse();
dimLength = stol(sizeExpr->unparse());
else if (constValSymb)
strDimLength = constValSymb->constantValue()->unparse();
dimLength = stol(constValSymb->constantValue()->unparse());
else if (subscriptExpr)
{
dimLength = stol(subscriptExpr->rhs()->unparse()) - stol(subscriptExpr->lhs()->unparse());
}
else
return false;
if (strDimLength == "0")
if (dimLength == 0)
return false;
declaredDims.push_back((uint64_t)stoi(strDimLength));
declaredDims.push_back(dimLength);
}
return true;
}
@@ -313,7 +316,8 @@ static bool CheckDimensionLength(const AccessingSet& array)
SgArrayRefExp* arrayRef = array.GetElements()[0][0].array;
if (!arrayRef)
return false;
vector<uint64_t> declaredDims(dimCount);
vector<uint64_t> declaredDims;
declaredDims.reserve(dimCount);
if (!getArrayDeclaredDimensions(arrayRef, declaredDims))
return false;
vector<ArrayDimension> testArray(dimCount);