https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110271
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The problem is that I thought match_arith_overflow returns true if it replaced something, but that is not the case, it only returns true for the BIT_NOT_EXPR case when it removed the stmt. So, I think the right test for whether match_arith_overflow actually replaced something is whether gsi_stmt (gsi) == stmt.