diff options
author | Jason Merrill <jason@redhat.com> | 2022-12-05 15:19:27 -0500 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2022-12-08 13:32:11 -0500 |
commit | 1e1847612d7f169f82c985b0b3a5e3301d6fe999 (patch) | |
tree | 43886abb4a1ab759fb6ebaf3d7472a7819de2c77 /intl | |
parent | 3da5ae7a347b7d74765053f4a08eaf7ec58f8735 (diff) | |
download | gcc-1e1847612d7f169f82c985b0b3a5e3301d6fe999.zip gcc-1e1847612d7f169f82c985b0b3a5e3301d6fe999.tar.gz gcc-1e1847612d7f169f82c985b0b3a5e3301d6fe999.tar.bz2 |
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.
Diffstat (limited to 'intl')
0 files changed, 0 insertions, 0 deletions