[Mlir-commits] [clang] [lld] [llvm] [mlir] [polly] [SetVector] Make SetVector::insert consistent (NFC) (PR #232372)

Alexis Engelke llvmlistbot at llvm.org
Fri Oct 16 04:34:49 PDT 2026


================
@@ -153,23 +153,26 @@ class SetVector {
   }
 
   /// Insert a new element into the SetVector.
-  /// \returns true if the element was inserted into the SetVector.
-  bool insert(const value_type &X) {
+  /// \returns a pair, whose first member is the iterator pointed to the
+  /// element, and the second member indicates if the element was inserted.
+  std::pair<iterator, bool> insert(const value_type &X) {
     if constexpr (canBeSmall())
       if (isSmall()) {
         if (!llvm::is_contained(vector_, X)) {
           vector_.push_back(X);
           if (vector_.size() > N)
             makeBig();
-          return true;
+          return {std::prev(vector_.end()), true};
         }
-        return false;
+        return {find(vector_, X), false};
----------------
aengelke wrote:

Are we sure this is always fully optimized out when unused? This also might shift inlining thresholds.

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


More information about the Mlir-commits mailing list