From d0e51c6d1974636579f687f9454c85ebeacc7cd2 Mon Sep 17 00:00:00 2001 From: Hal Finkel Date: Thu, 15 Nov 2012 00:34:28 +0000 Subject: Merge r167942, r167966 to fix non-deterministic behavior in BBVectorize git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_32@168012 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Vectorize/BBVectorize.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/Transforms/Vectorize/BBVectorize.cpp b/lib/Transforms/Vectorize/BBVectorize.cpp index df50589eb6..dacbc7f242 100644 --- a/lib/Transforms/Vectorize/BBVectorize.cpp +++ b/lib/Transforms/Vectorize/BBVectorize.cpp @@ -1485,7 +1485,7 @@ namespace { PrunedTree.insert(QTop.first); // Visit each child, pruning as necessary... - DenseMap BestChildren; + SmallVector BestChildren; VPPIteratorPair QTopRange = ConnectedPairs.equal_range(QTop.first); for (std::multimap::iterator K = QTopRange.first; K != QTopRange.second; ++K) { @@ -1517,7 +1517,7 @@ namespace { DenseSet CurrentPairs; bool CanAdd = true; - for (DenseMap::iterator C2 + for (SmallVector::iterator C2 = BestChildren.begin(), E2 = BestChildren.end(); C2 != E2; ++C2) { if (C2->first.first == C->first.first || @@ -1602,22 +1602,22 @@ namespace { // to an already-selected child. Check for this here, and if a // conflict is found, then remove the previously-selected child // before adding this one in its place. - for (DenseMap::iterator C2 + for (SmallVector::iterator C2 = BestChildren.begin(); C2 != BestChildren.end();) { if (C2->first.first == C->first.first || C2->first.first == C->first.second || C2->first.second == C->first.first || C2->first.second == C->first.second || pairsConflict(C2->first, C->first, PairableInstUsers)) - BestChildren.erase(C2++); + C2 = BestChildren.erase(C2); else ++C2; } - BestChildren.insert(ValuePairWithDepth(C->first, C->second)); + BestChildren.push_back(ValuePairWithDepth(C->first, C->second)); } - for (DenseMap::iterator C + for (SmallVector::iterator C = BestChildren.begin(), E2 = BestChildren.end(); C != E2; ++C) { size_t DepthF = getDepthFactor(C->first.first); -- cgit v1.2.3