https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101923
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Component|libstdc++ |tree-optimization --- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Hmm __tmp = MEM[(union _Any_data & {ref-all})&f]; MEM[(union _Any_data * {ref-all})&f] = MEM[(union _Any_data & {ref-all})&moved]; MEM[(union _Any_data * {ref-all})&moved] = __tmp; __tmp ={v} {CLOBBER}; _13 = MEM[(void (*type) (const union _Any_data & {ref-all}, const struct Car &) &)&f + 24]; _14 = MEM[(void (*type) (const union _Any_data & {ref-all}, const struct Car &) &)&moved + 24]; MEM[(void (*<Te9f8>) (const union _Any_data & {ref-all}, const struct Car &) &)&f + 24] = _14; MEM[(void (*<Te9f8>) (const union _Any_data & {ref-all}, const struct Car &) &)&moved + 24] = _13; So a missed optimization at the gimple level. But note the arm64 compiler on godbolt is a few months old, 20210528. There might have been some fixes which improve this already.