https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105838

--- Comment #17 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>:

https://gcc.gnu.org/g:1e1847612d7f169f82c985b0b3a5e3301d6fe999

commit r13-4563-g1e1847612d7f169f82c985b0b3a5e3301d6fe999
Author: Jason Merrill <ja...@redhat.com>
Date:   Mon Dec 5 15:19:27 2022 -0500

    c++: fewer allocator temps [PR105838]

    In this PR, initializing the array of std::string to pass to the vector
    initializer_list constructor gets very confusing to the optimizers as the
    number of elements increases, primarily because of all the std::allocator
    temporaries passed to all the string constructors.  Instead of creating one
    for each string, let's share an allocator between all the strings; we can
do
    this safely because we know that std::allocator is stateless and that
string
    doesn't care about the object identity of its allocator parameter.

            PR c++/105838

    gcc/cp/ChangeLog:

            * cp-tree.h (is_std_allocator): Declare.
            * constexpr.cc (is_std_allocator): Split out  from...
            (is_std_allocator_allocate): ...here.
            * init.cc (find_temps_r): New.
            (find_allocator_temp): New.
            (build_vec_init): Use it.

    gcc/testsuite/ChangeLog:

            * g++.dg/tree-ssa/allocator-opt1.C: New test.

Reply via email to