aboutsummaryrefslogtreecommitdiff
path: root/gcc/resource.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-03-12 08:28:05 +0100
committerJakub Jelinek <jakub@redhat.com>2020-03-12 08:28:05 +0100
commit4069adf4bbc90d16b603e0308b48499c36b2b637 (patch)
treeeb80f36b3b6fac6badfaf0f01619bbc06ae8ae05 /gcc/resource.c
parentaedb4c8fc77034a3a009bee887691d5727658627 (diff)
downloadgcc-4069adf4bbc90d16b603e0308b48499c36b2b637.zip
gcc-4069adf4bbc90d16b603e0308b48499c36b2b637.tar.gz
gcc-4069adf4bbc90d16b603e0308b48499c36b2b637.tar.bz2
c++: Tweak reshape_init_array_1 [PR94124]
Isn't it wasteful to first copy perhaps a large constructor (recursively) and then truncate it to very few elts (zero in this case)? > We should certainly avoid copying if they're the same. The code above for > only copying the bits that aren't going to be thrown away seems pretty > straightforward, might as well use it even if the savings aren't likely to > be large. Calling vec_safe_truncate with the same number of elts the vector already has is a nop, so IMHO we just should make sure we only unshare if it changed. 2020-03-12 Jakub Jelinek <jakub@redhat.com> PR c++/94124 * decl.c (reshape_init_array_1): Don't unshare constructor if there aren't any trailing zero elts, otherwise only unshare the first nelts.
Diffstat (limited to 'gcc/resource.c')
0 files changed, 0 insertions, 0 deletions