[llvm] [ADT] Introduce SetVector::reserve (NFC) (PR #209951)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 23:59:12 PDT 2026


================
@@ -102,6 +106,14 @@ class SetVector {
   /// Determine the number of elements in the SetVector.
   [[nodiscard]] size_type size() const { return vector_.size(); }
 
+  /// Reserve space in the SetVector if supported by the underlying containers.
----------------
kazutakahirata wrote:

Yes:

```
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
2207:  SetVector<int64_t, SmallVector<int64_t, 8>, SmallSet<int64_t, 8>> Factors;
```

`SmallSet` does not have `reserve`.

https://github.com/llvm/llvm-project/pull/209951


More information about the llvm-commits mailing list