fixed merging

This commit is contained in:
ALEXks
2025-06-11 11:31:48 +03:00
parent 1895a4b02a
commit 8ad19cbfa5
5 changed files with 17 additions and 17 deletions

View File

@@ -2,8 +2,8 @@
#include <map> #include <map>
#include <unordered_set> #include <unordered_set>
#include <string> #include <string>
#include <numeric>
#include "utils.h"
#include "range_structures.h" #include "range_structures.h"
using namespace std; using namespace std;

View File

@@ -146,7 +146,7 @@ static int GetDefUseArray(SAPFOR::BasicBlock* block, LoopGraph* loop, ArrayAcces
{ {
auto var = index_vars.back(); auto var = index_vars.back();
int currentVarPos = refPos.back(); int currentVarPos = refPos.back();
pair currentCoefs = coefsForDims.back(); pair<int, int> currentCoefs = coefsForDims.back();
ArrayDimension current_dim; ArrayDimension current_dim;
if (var->getType() == SAPFOR::CFG_ARG_TYPE::CONST) if (var->getType() == SAPFOR::CFG_ARG_TYPE::CONST)
current_dim = { stoul(var->getValue()), 1, 1 }; current_dim = { stoul(var->getValue()), 1, 1 };

View File

@@ -4,6 +4,7 @@
#include "expr_transform.h" #include "expr_transform.h"
#include "errors.h" #include "errors.h"
#include "SgUtils.h" #include "SgUtils.h"
#include "utils.h"
#include <string> #include <string>
#include <vector> #include <vector>
#include <queue> #include <queue>
@@ -17,19 +18,6 @@ using std::make_pair;
using std::queue; using std::queue;
using std::wstring; 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) static SgSymbol* getLoopSymbol(const LoopGraph* loop)
{ {
if (!loop || !loop->isFor) if (!loop || !loop->isFor)
@@ -1385,7 +1373,6 @@ static int getNewStep(SgForStmt* firstLoopStmt, SgForStmt* loopStmt)
step2Val = step2->valueInteger(); step2Val = step2->valueInteger();
int stepGcd = gcd(std::abs(step1Val), std::abs(step2Val)); int stepGcd = gcd(std::abs(step1Val), std::abs(step2Val));
int newStep = stepGcd; int newStep = stepGcd;
int startDifference = 0; int startDifference = 0;

View File

@@ -101,3 +101,16 @@ std::set<std::string> fillDistributedArrays(const DataDirective& dataDirectives,
void copyStringToShort(short*& result, const std::string& resVal, bool withEnd = true); void copyStringToShort(short*& result, const std::string& resVal, bool withEnd = true);
void dumpMessages(bool inCatch, const std::map<std::string, std::vector<Messages>>& messages, const char* vis_path); void dumpMessages(bool inCatch, const std::map<std::string, std::vector<Messages>>& messages, const char* vis_path);
template<typename T>
inline T gcd(T a, T b)
{
while (a != b)
{
if (a > b)
a = a - b;
else
b = b - a;
}
return a;
}

View File

@@ -1,3 +1,3 @@
#pragma once #pragma once
#define VERSION_SPF "2423" #define VERSION_SPF "2424"