https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102141
--- Comment #5 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:45ff12512e568089a4c7b85b5322ab8019723cd9 commit r12-3280-g45ff12512e568089a4c7b85b5322ab8019723cd9 Author: Jakub Jelinek <ja...@redhat.com> Date: Wed Sep 1 12:06:25 2021 +0200 bswap: Fix up bswap_view_convert handling [PR102141] bswap_view_convert is used twice in spots where gsi_insert_before is the right thing, but in the last one it wants to insert preparation stmts for the VIEW_CONVERT_EXPR emitted with gsi_insert_after, where at the gsi we still need to insert bswap_stmt and maybe mask_stmt whose lhs the preparation stmts will use. So, this patch adds a BEFORE argument to the function and emits the preparation statements before or after depending on that. 2021-09-01 Jakub Jelinek <ja...@redhat.com> PR tree-optimization/102141 * gimple-ssa-store-merging.c (bswap_view_convert): Add BEFORE argument. If false, emit stmts after gsi instead of before, and with GSI_NEW_STMT. (bswap_replace): Adjust callers. When converting output of bswap, emit VIEW_CONVERT prepratation stmts after a copy of gsi instead of before it. * gcc.dg/pr102141.c: New test.