https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99520
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Bet handling PLUS_EXPR next to BIT_IOR_EXPR in find_bswap_or_nop_1 and pass_optimize_bswap::execute could do the trick. Though, I guess for PLUS_EXPR one needs stronger tests in perform_symbolic_merge. Because for BIT_IOR_EXPR, it is perfectly fine if the same bytes are ored in multiple times, but for PLUS_EXPR it obviously is not. So masked1 = n1->n & mask; masked2 = n2->n & mask; if (masked1 && masked2 && masked1 != masked2) return NULL; is good enough for BIT_IOR_EXPR, but PLUS_EXPR would need a if (masked1 && masked2) return NULL; test.