1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[Hexagon] Remove indeterministic traversal order

Patch by Sergei Larin.

llvm-svn: 358505
This commit is contained in:
Krzysztof Parzyszek 2019-04-16 16:05:07 +00:00
parent cf36d99522
commit 111036dff8

View File

@ -11,6 +11,7 @@
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Analysis/LoopInfo.h"
@ -70,7 +71,7 @@ namespace {
using NodeToValueMap = std::map<GepNode *, Value *>;
using NodeVect = std::vector<GepNode *>;
using NodeChildrenMap = std::map<GepNode *, NodeVect>;
using UseSet = std::set<Use *>;
using UseSet = SetVector<Use *>;
using NodeToUsesMap = std::map<GepNode *, UseSet>;
// Numbering map for gep nodes. Used to keep track of ordering for
@ -979,15 +980,13 @@ void HexagonCommonGEP::separateChainForNode(GepNode *Node, Use *U,
assert(UF != Uses.end());
UseSet &Us = UF->second;
UseSet NewUs;
for (UseSet::iterator I = Us.begin(); I != Us.end(); ) {
User *S = (*I)->getUser();
UseSet::iterator Nx = std::next(I);
if (S == R) {
NewUs.insert(*I);
Us.erase(I);
}
I = Nx;
for (Use *U : Us) {
if (U->getUser() == R)
NewUs.insert(U);
}
for (Use *U : NewUs)
Us.remove(U); // erase takes an iterator.
if (Us.empty()) {
Node->Flags &= ~GepNode::Used;
Uses.erase(UF);