diff --git a/src/PrivateAnalyzer/range_structures.cpp b/src/PrivateAnalyzer/range_structures.cpp index 75f2779..80255ab 100644 --- a/src/PrivateAnalyzer/range_structures.cpp +++ b/src/PrivateAnalyzer/range_structures.cpp @@ -2,8 +2,8 @@ #include #include #include -#include +#include "utils.h" #include "range_structures.h" using namespace std; diff --git a/src/PrivateAnalyzer/region.cpp b/src/PrivateAnalyzer/region.cpp index 5030fe3..71fbd22 100644 --- a/src/PrivateAnalyzer/region.cpp +++ b/src/PrivateAnalyzer/region.cpp @@ -146,7 +146,7 @@ static int GetDefUseArray(SAPFOR::BasicBlock* block, LoopGraph* loop, ArrayAcces { auto var = index_vars.back(); int currentVarPos = refPos.back(); - pair currentCoefs = coefsForDims.back(); + pair currentCoefs = coefsForDims.back(); ArrayDimension current_dim; if (var->getType() == SAPFOR::CFG_ARG_TYPE::CONST) current_dim = { stoul(var->getValue()), 1, 1 }; diff --git a/src/Transformations/LoopCombining/loops_combiner.cpp b/src/Transformations/LoopCombining/loops_combiner.cpp index 747839a..c0ac86e 100644 --- a/src/Transformations/LoopCombining/loops_combiner.cpp +++ b/src/Transformations/LoopCombining/loops_combiner.cpp @@ -4,6 +4,7 @@ #include "expr_transform.h" #include "errors.h" #include "SgUtils.h" +#include "utils.h" #include #include #include @@ -17,19 +18,6 @@ using std::make_pair; using std::queue; using std::wstring; -static int gcd(int a, int b) -{ - while (a != b) - { - if (a > b) - a = a - b; - else - b = b - a; - } - - return a; -} - static SgSymbol* getLoopSymbol(const LoopGraph* loop) { if (!loop || !loop->isFor) @@ -1385,7 +1373,6 @@ static int getNewStep(SgForStmt* firstLoopStmt, SgForStmt* loopStmt) step2Val = step2->valueInteger(); int stepGcd = gcd(std::abs(step1Val), std::abs(step2Val)); - int newStep = stepGcd; int startDifference = 0; diff --git a/src/Utils/utils.h b/src/Utils/utils.h index 77136e4..fc2611f 100644 --- a/src/Utils/utils.h +++ b/src/Utils/utils.h @@ -101,3 +101,16 @@ std::set fillDistributedArrays(const DataDirective& dataDirectives, void copyStringToShort(short*& result, const std::string& resVal, bool withEnd = true); void dumpMessages(bool inCatch, const std::map>& messages, const char* vis_path); + +template +inline T gcd(T a, T b) +{ + while (a != b) + { + if (a > b) + a = a - b; + else + b = b - a; + } + return a; +} diff --git a/src/Utils/version.h b/src/Utils/version.h index 6f49767..4f8972a 100644 --- a/src/Utils/version.h +++ b/src/Utils/version.h @@ -1,3 +1,3 @@ #pragma once -#define VERSION_SPF "2423" +#define VERSION_SPF "2424"