[v3 PATCH] Don't revisit a variant we are already visiting.
Ville Voutilainen
ville.voutilainen@gmail.com
Thu Mar 28 13:21:00 GMT 2019
On Thu, 28 Mar 2019 at 15:07, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
>
> This shaves off some unnecessary codegen. In the assignment
> operators and swap, we are already visiting the rhs, so we shouldn't
> visit it again to get to its guts, we already have them in-hand.
>
> 2019-03-28 Ville Voutilainen <ville.voutilainen@gmail.com>
>
> Don't revisit a variant we are already visiting.
> * include/std/variant (__variant_construct_single): New.
> (__variant_construct): Use it.
> (_M_destructive_move): Likewise, turn into a template.
> (_M_destructive_copy): Likewise.
> (_Copy_assign_base::operator=): Adjust.
> (_Move_assign_base::operator=): Likewise.
> (swap): Likewise.
Minor adjustment, use direct-init in all cases:
-+ auto __tmp = std::move(__rhs_mem);
++ auto __tmp(std::move(__rhs_mem));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: no-variant-revisit_2.diff
Type: text/x-patch
Size: 6080 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20190328/80eea2b8/attachment.bin>
More information about the Libstdc++
mailing list