Compare commits
5 Commits
egormayoro
...
3058882793
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3058882793 | ||
|
|
63615ae50e | ||
|
|
746bdf29b2 | ||
|
|
16f0560c8e | ||
|
|
8cae169131 |
Submodule projects/dvm updated: ab99430aee...4d4041a081
Submodule projects/libpredictor updated: 7e57477dfa...d0772cdb57
@@ -470,8 +470,6 @@ static bool reorderOperatorsInBasicBlockUsingDeps(SAPFOR::BasicBlock* bb, const
|
||||
// as close as possible after its last dependency (if any).
|
||||
const auto depsMap = analyzeBasicBlockIntraDependencies(bb);
|
||||
vector<SgStatement*> order = ops;
|
||||
const vector<SgStatement*> originalOrder = ops;
|
||||
const int nOrig = (int)originalOrder.size();
|
||||
|
||||
auto indexIn = [](const vector<SgStatement*>& v, SgStatement* s) -> int
|
||||
{
|
||||
@@ -481,59 +479,37 @@ static bool reorderOperatorsInBasicBlockUsingDeps(SAPFOR::BasicBlock* bb, const
|
||||
return -1;
|
||||
};
|
||||
|
||||
auto indexInOriginal = [&](SgStatement* s) -> int
|
||||
{
|
||||
return indexIn(originalOrder, s);
|
||||
};
|
||||
|
||||
for (SgStatement* s : ops)
|
||||
{
|
||||
auto itDeps = depsMap.find(s);
|
||||
if (itDeps == depsMap.end() || itDeps->second.empty())
|
||||
continue;
|
||||
|
||||
int lastDepOrigIdx = -1;
|
||||
for (SgStatement* dep : itDeps->second)
|
||||
{
|
||||
const int j = indexInOriginal(dep);
|
||||
if (j >= 0)
|
||||
lastDepOrigIdx = max(lastDepOrigIdx, j);
|
||||
}
|
||||
if (lastDepOrigIdx < 0)
|
||||
continue;
|
||||
|
||||
SgStatement* successor = nullptr;
|
||||
if (lastDepOrigIdx + 1 < nOrig)
|
||||
successor = originalOrder[lastDepOrigIdx + 1];
|
||||
|
||||
int posS = indexIn(order, s);
|
||||
if (posS < 0)
|
||||
continue;
|
||||
|
||||
if (successor == nullptr)
|
||||
int lastDepIdx = -1;
|
||||
for (SgStatement* dep : itDeps->second)
|
||||
{
|
||||
if (posS == (int)order.size() - 1)
|
||||
continue;
|
||||
order.erase(order.begin() + posS);
|
||||
order.push_back(s);
|
||||
continue;
|
||||
const int j = indexIn(order, dep);
|
||||
if (j >= 0)
|
||||
lastDepIdx = max(lastDepIdx, j);
|
||||
}
|
||||
|
||||
if (successor == s)
|
||||
if (lastDepIdx < 0)
|
||||
continue;
|
||||
|
||||
const int posSucc = indexIn(order, successor);
|
||||
if (posSucc < 0)
|
||||
continue;
|
||||
|
||||
if (posS + 1 == posSucc)
|
||||
if (posS == lastDepIdx + 1)
|
||||
continue;
|
||||
|
||||
order.erase(order.begin() + posS);
|
||||
const int posSucc2 = indexIn(order, successor);
|
||||
if (posSucc2 < 0)
|
||||
printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
|
||||
order.insert(order.begin() + posSucc2, s);
|
||||
|
||||
int lp = lastDepIdx;
|
||||
if (posS < lastDepIdx)
|
||||
lp = lastDepIdx - 1;
|
||||
|
||||
const int insertAt = lp + 1;
|
||||
order.insert(order.begin() + insertAt, s);
|
||||
}
|
||||
|
||||
bool changed = false;
|
||||
|
||||
Reference in New Issue
Block a user