diff --git a/sapfor/experts/Sapfor_2017/_src/Inliner/inliner.cpp b/sapfor/experts/Sapfor_2017/_src/Inliner/inliner.cpp index c55acd2..a37d947 100644 --- a/sapfor/experts/Sapfor_2017/_src/Inliner/inliner.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Inliner/inliner.cpp @@ -137,6 +137,11 @@ static map createMapOfArgs(SgStatement* tempHedr, SgExpre return vars; } +static bool isAllocated(SgSymbol* s) +{ + return (s->attributes() & ALLOCATABLE_BIT) || (s->attributes() & POINTER_BIT); +} + static inline SgSymbol* createSymbAndDecl(const string& funcName, const string& varName, SgSymbol* newS, set& newSymbols, SgType* type = NULL) { SgSymbol* original = newS; @@ -208,7 +213,7 @@ static inline SgSymbol* createSymbAndDecl(const string& funcName, const string& { createdByFunc[key][varName] = newS; count[0] = nextCount; - if (original && (original->attributes() & ALLOCATABLE_BIT)) + if (original && isAllocated(original)) linkToOrig[newS] = original; } else @@ -266,7 +271,7 @@ static vector getLowBounds(SgSymbol* arrayS) SgExpression* list = NULL; - if (arrayS->attributes() & ALLOCATABLE_BIT) + if (isAllocated(arrayS)) { SgSymbol* copyFrom = NULL; if (linkToOrig.find(arrayS) == linkToOrig.end()) @@ -332,7 +337,7 @@ static vector getLowBounds(SgSymbol* arrayS) static vector getBoundsExpression(SgSymbol* arrayS) { - if (arrayS->attributes() & ALLOCATABLE_BIT) + if (isAllocated(arrayS)) printInternalError(convertFileName(__FILE__).c_str(), __LINE__); auto type = isSgArrayType(arrayS->type()); @@ -2163,7 +2168,7 @@ static void createDeclarations(const map>& newSymbs if (globalType != 1) // not in COMMON saveRefs[toDec->identifier()] = toDec; - if (toDec->attributes() & ALLOCATABLE_BIT) + if (isAllocated(toDec)) allocatable.insert(toDec); if (toDec->attributes() & DATA_BIT) diff --git a/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp b/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp index 4a006d0..a03ca66 100644 --- a/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp +++ b/sapfor/experts/Sapfor_2017/_src/Sapfor.cpp @@ -1172,9 +1172,9 @@ static bool runAnalysis(SgProject &project, const int curr_regime, const bool ne addPrivatesToArraysFromGUI(file, declaredArrays, distrStateFromGUI); else if (curr_regime == REMOVE_DEAD_CODE_AND_UNPARSE) { - auto funcsForFile = getObjectForFileFromMap(file_name, allFuncInfo_IR); + auto funcsForFile = getObjectForFileFromMap(file_name, allFuncInfo); for (auto& func : funcsForFile) - removeDeadCode(func->funcPointer, allFuncInfo_IR, commonBlocks); + removeDeadCode(func->funcPointer, allFuncInfo, commonBlocks); } else if (curr_regime == TEST_PASS) { diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h b/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h index 88ed1ba..dc83bb7 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/PassManager.h @@ -306,7 +306,7 @@ void InitPassesDependencies(map> &passDepsIn, set Pass(REMOVE_OMP_DIRS) <= Pass(REMOVE_OMP_DIRS_TRANSFORM); - Pass(BUILD_IR) <= Pass(REMOVE_DEAD_CODE_AND_UNPARSE); + Pass(CALL_GRAPH2) <= Pass(REMOVE_DEAD_CODE_AND_UNPARSE); passesIgnoreStateDone.insert({ CREATE_PARALLEL_DIRS, INSERT_PARALLEL_DIRS, INSERT_SHADOW_DIRS, EXTRACT_PARALLEL_DIRS, EXTRACT_SHADOW_DIRS, CREATE_REMOTES, UNPARSE_FILE, REMOVE_AND_CALC_SHADOW, diff --git a/sapfor/experts/Sapfor_2017/_src/Utils/version.h b/sapfor/experts/Sapfor_2017/_src/Utils/version.h index f92efdc..97fb9d3 100644 --- a/sapfor/experts/Sapfor_2017/_src/Utils/version.h +++ b/sapfor/experts/Sapfor_2017/_src/Utils/version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION_SPF "2265" +#define VERSION_SPF "2267" diff --git a/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp b/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp index 826c2cf..6ec8dd9 100644 --- a/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp +++ b/sapfor/experts/Sapfor_2017/_src/VisualizerCalls/get_information.cpp @@ -1895,6 +1895,14 @@ int SPF_InsertPrivateFromGUI(void*& context, int winHandler, short* options, sho return simpleTransformPass(INSERT_NO_DISTR_FLAGS_FROM_GUI, options, projName, folderName, output, outputSize, outputMessage, outputMessageSize); } +int SPF_RemoveDeadCode(void*& context, int winHandler, short* options, short* projName, short* folderName, short*& output, + int*& outputSize, short*& outputMessage, int*& outputMessageSize) +{ + MessageManager::clearCache(); + MessageManager::setWinHandler(winHandler); + return simpleTransformPass(REMOVE_DEAD_CODE_AND_UNPARSE, options, projName, folderName, output, outputSize, outputMessage, outputMessageSize); +} + static inline void convertBackSlash(char *str, int strL) { for (int z = 0; z < strL; ++z) @@ -2607,6 +2615,8 @@ const wstring Sapfor_RunTransformation(const char* transformName_c, const char* retCode = SPF_SharedMemoryParallelization(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize); else if (whichRun == "SPF_InsertPrivateFromGUI") retCode = SPF_InsertPrivateFromGUI(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize); + else if (whichRun == "SPF_RemoveDeadCode") + retCode = SPF_RemoveDeadCode(context, winHandler, optSh, projSh, fold, output, outputSize, outputMessage, outputMessageSize); else { if (showDebug)