[llvm] 6ba6351 - [PostOrderIterator] Use SmallVector to store stack; NFC
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 29 05:29:34 PDT 2020
Author: Nikita Popov
Date: 2020-03-29T14:29:02+02:00
New Revision: 6ba63510720f5bd6033a3eeffd51f8d7e0e90432
URL: https://github.com/llvm/llvm-project/commit/6ba63510720f5bd6033a3eeffd51f8d7e0e90432
DIFF: https://github.com/llvm/llvm-project/commit/6ba63510720f5bd6033a3eeffd51f8d7e0e90432.diff
LOG: [PostOrderIterator] Use SmallVector to store stack; NFC
We use a SmallPtrSet to track visited nodes, use a SmallVector
of the same size for the stack.
Added:
Modified:
llvm/include/llvm/ADT/PostOrderIterator.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/PostOrderIterator.h b/llvm/include/llvm/ADT/PostOrderIterator.h
index 2fe7447a8e77..bb413a956d9f 100644
--- a/llvm/include/llvm/ADT/PostOrderIterator.h
+++ b/llvm/include/llvm/ADT/PostOrderIterator.h
@@ -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>
@@ -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);
More information about the llvm-commits
mailing list