aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/Vectorize
diff options
context:
space:
mode:
authorHal Finkel <hfinkel@anl.gov>2012-02-02 17:29:39 +0000
committerHal Finkel <hfinkel@anl.gov>2012-02-02 17:29:39 +0000
commit35564dc3ae1c377abad425cb09928eaf676dcb3c (patch)
tree5b1a23a229c98689a2d5d6536bafa78ab22817dc /lib/Transforms/Vectorize
parent7a73925c505de55959fece06e0a1e20b713d90f3 (diff)
Minor changes from review.
As suggested by Nick Lewycky, the tree traversal queues have been changed to SmallVectors and the associated loops have been rotated. Also, an 80-col violation was fixed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149607 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Vectorize')
-rw-r--r--lib/Transforms/Vectorize/BBVectorize.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/lib/Transforms/Vectorize/BBVectorize.cpp b/lib/Transforms/Vectorize/BBVectorize.cpp
index 40e66a7c9b..dc88e2c85f 100644
--- a/lib/Transforms/Vectorize/BBVectorize.cpp
+++ b/lib/Transforms/Vectorize/BBVectorize.cpp
@@ -464,10 +464,11 @@ namespace {
DenseSet<ValuePair> PairableInstUsers;
buildDepMap(BB, CandidatePairs, PairableInsts, PairableInstUsers);
- // There is now a graph of the connected pairs. For each variable, pick the
- // pairing with the largest tree meeting the depth requirement on at least
- // one branch. Then select all pairings that are part of that tree and
- // remove them from the list of available pairings and pairable variables.
+ // There is now a graph of the connected pairs. For each variable, pick
+ // the pairing with the largest tree meeting the depth requirement on at
+ // least one branch. Then select all pairings that are part of that tree
+ // and remove them from the list of available pairings and pairable
+ // variables.
DenseMap<Value *, Value *> ChosenPairs;
choosePairs(CandidatePairs, PairableInsts, ConnectedPairs,
@@ -936,14 +937,12 @@ namespace {
// A lookup table of visisted pairs is kept because the PairableInstUserMap
// contains non-direct associations.
DenseSet<ValuePair> Visited;
- std::vector<ValuePair> Q;
+ SmallVector<ValuePair, 32> Q;
// General depth-first post-order traversal:
Q.push_back(P);
- while (!Q.empty()) {
- ValuePair QTop = Q.back();
-
+ do {
+ ValuePair QTop = Q.pop_back_val();
Visited.insert(QTop);
- Q.pop_back();
DEBUG(if (DebugCycleCheck)
dbgs() << "BBV: cycle check visiting: " << *QTop.first << " <-> "
@@ -962,7 +961,7 @@ namespace {
Visited.count(C->second) == 0)
Q.push_back(C->second);
}
- }
+ } while (!Q.empty());
return false;
}
@@ -979,10 +978,10 @@ namespace {
// Each of these pairs is viewed as the root node of a Tree. The Tree
// is then walked (depth-first). As this happens, we keep track of
// the pairs that compose the Tree and the maximum depth of the Tree.
- std::vector<ValuePairWithDepth> Q;
+ SmallVector<ValuePairWithDepth, 32> Q;
// General depth-first post-order traversal:
Q.push_back(ValuePairWithDepth(J, getDepthFactor(J.first)));
- while (!Q.empty()) {
+ do {
ValuePairWithDepth QTop = Q.back();
// Push each child onto the queue:
@@ -1020,7 +1019,7 @@ namespace {
Tree.insert(ValuePairWithDepth(QTop.first, MaxChildDepth));
Q.pop_back();
}
- }
+ } while (!Q.empty());
}
// Given some initial tree, prune it by removing conflicting pairs (pairs
@@ -1035,13 +1034,12 @@ namespace {
DenseMap<ValuePair, size_t> &Tree,
DenseSet<ValuePair> &PrunedTree, ValuePair J,
bool UseCycleCheck) {
- std::vector<ValuePairWithDepth> Q;
+ SmallVector<ValuePairWithDepth, 32> Q;
// General depth-first post-order traversal:
Q.push_back(ValuePairWithDepth(J, getDepthFactor(J.first)));
- while (!Q.empty()) {
- ValuePairWithDepth QTop = Q.back();
+ do {
+ ValuePairWithDepth QTop = Q.pop_back_val();
PrunedTree.insert(QTop.first);
- Q.pop_back();
// Visit each child, pruning as necessary...
DenseMap<ValuePair, size_t> BestChilden;
@@ -1114,7 +1112,7 @@ namespace {
if (!CanAdd) continue;
// And check the queue too...
- for (std::vector<ValuePairWithDepth>::iterator C2 = Q.begin(),
+ for (SmallVector<ValuePairWithDepth, 32>::iterator C2 = Q.begin(),
E2 = Q.end(); C2 != E2; ++C2) {
if (C2->first.first == C->first.first ||
C2->first.first == C->first.second ||
@@ -1182,7 +1180,7 @@ namespace {
size_t DepthF = getDepthFactor(C->first.first);
Q.push_back(ValuePairWithDepth(C->first, QTop.second+DepthF));
}
- }
+ } while (!Q.empty());
}
// This function finds the best tree of mututally-compatible connected