Skip to content

Commit

Permalink
[PostOrderIterator] Use SmallVector to store stack; NFC
Browse files Browse the repository at this point in the history
We use a SmallPtrSet to track visited nodes, use a SmallVector
of the same size for the stack.
  • Loading branch information
nikic committed Mar 29, 2020
1 parent a7115d5 commit 6ba6351
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/include/llvm/ADT/PostOrderIterator.h
Expand Up @@ -18,6 +18,7 @@
#include "llvm/ADT/GraphTraits.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/iterator_range.h"
#include <iterator>
#include <set>
Expand Down Expand Up @@ -101,7 +102,7 @@ class po_iterator

// VisitStack - Used to maintain the ordering. Top = current block
// First element is basic block pointer, second is the 'next child' to visit
std::vector<std::pair<NodeRef, ChildItTy>> VisitStack;
SmallVector<std::pair<NodeRef, ChildItTy>, 8> VisitStack;

po_iterator(NodeRef BB) {
this->insertEdge(Optional<NodeRef>(), BB);
Expand Down

0 comments on commit 6ba6351

Please sign in to comment.