[llvm] 7311a69 - [ADT] Use SmallVector in df_iterator. NFC (#225787)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 23 09:54:15 PDT 2026


Author: Luke Lau
Date: 2026-09-23T16:54:07Z
New Revision: 7311a69f6caa2a6b50cfb899d4b8a1f9f9eeb210

URL: https://github.com/llvm/llvm-project/commit/7311a69f6caa2a6b50cfb899d4b8a1f9f9eeb210
DIFF: https://github.com/llvm/llvm-project/commit/7311a69f6caa2a6b50cfb899d4b8a1f9f9eeb210.diff

LOG: [ADT] Use SmallVector in df_iterator. NFC (#225787)

Helps with compile time. The small size of 8 was chosen to match
ReversePostOrderTraversal.


https://llvm-compile-time-tracker.com/compare.php?from=5bb2e21c30de31871dd01279c13abcfa2c06e75f&to=3f3c5680cae30aa33f6988ee8b326b71f5195577&stat=instructions:u

Added: 
    

Modified: 
    llvm/include/llvm/ADT/DepthFirstIterator.h

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/DepthFirstIterator.h b/llvm/include/llvm/ADT/DepthFirstIterator.h
index d2d3da3cd6fdf..97febd9777cc1 100644
--- a/llvm/include/llvm/ADT/DepthFirstIterator.h
+++ b/llvm/include/llvm/ADT/DepthFirstIterator.h
@@ -36,12 +36,12 @@
 
 #include "llvm/ADT/GraphTraits.h"
 #include "llvm/ADT/SmallPtrSet.h"
+#include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/iterator_range.h"
 #include <iterator>
 #include <optional>
 #include <type_traits>
 #include <utility>
-#include <vector>
 
 namespace llvm {
 
@@ -104,7 +104,7 @@ class df_iterator : public df_iterator_storage<SetType, ExtStorage> {
   using StackElement = std::pair<NodeRef, std::optional<ChildItTy>>;
 
   // VisitStack - Used to maintain the ordering.  Top = current block
-  std::vector<StackElement> VisitStack;
+  SmallVector<StackElement, 8> VisitStack;
 
   inline df_iterator(NodeRef Node) {
     this->Visited.insert(Node);


        


More information about the llvm-commits mailing list