https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98568
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jakub Jelinek <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:d02a8b63e5aef49ab6973c64a2225236895763a1 commit r11-6515-gd02a8b63e5aef49ab6973c64a2225236895763a1 Author: Jakub Jelinek <ja...@redhat.com> Date: Thu Jan 7 09:57:40 2021 +0100 bswap: Fix up recent vector CONSTRUCTOR optimization [PR98568] As the testcase shows, bswap can match even byte-swapping or indentity from low part of some wider SSA_NAME. For bswap replacement other than for vector CONSTRUCTOR the code has been using NOP_EXPR casts if the types weren't compatible, but for vectors we need to use VIEW_CONVERT_EXPR. The problem with the latter is that we require that it has the same size, which isn't guaranteed, so this patch in those cases first adds a narrowing NOP_EXPR cast and only afterwards does a VIEW_CONVERT_EXPR. 2021-01-07 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/98568 * gimple-ssa-store-merging.c (bswap_view_convert): New function. (bswap_replace): Use it. * g++.dg/torture/pr98568.C: New test.