[libcxx-commits] [libcxx] [libcxx] Optimize __split_buffer::__relocate by using size-based __set_valid_range (PR #216822)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Sep 9 07:05:58 PDT 2026


https://github.com/ldionne updated https://github.com/llvm/llvm-project/pull/216822

>From 901706d2efc97ec8eca0aaa5666608d1b4b84f62 Mon Sep 17 00:00:00 2001
From: Liza Burakova <liza at chromium.org>
Date: Thu, 3 Sep 2026 18:26:19 +0000
Subject: [PATCH] [libcxx] Optimize __split_buffer::__relocate by using
 size-based __set_valid_range

---
 libcxx/include/__split_buffer | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libcxx/include/__split_buffer b/libcxx/include/__split_buffer
index d89264186d77e..b2bf4c84dd737 100644
--- a/libcxx/include/__split_buffer
+++ b/libcxx/include/__split_buffer
@@ -416,7 +416,8 @@ public:
     auto __last      = __first + __n;
     std::__uninitialized_allocator_relocate(
         __alloc_, std::__to_address(__first), std::__to_address(__last), std::__to_address(__new_begin));
-    __set_valid_range(__new_begin, end());
+    __set_valid_range(__new_begin, __n);
+
     __n = 0;
 
     __swap_layouts(__first, __n, __capacity);



More information about the libcxx-commits mailing list