https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80693
Alexandre Oliva <aoliva at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |aoliva at gcc dot gnu.org --- Comment #2 from Alexandre Oliva <aoliva at gcc dot gnu.org> --- Created attachment 41371 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41371&action=edit patch I'm testing to fix the bug The problem is that combine creates a single insn with the AND and the compare, still modifying the same REG that is also an AND operand. Later, it combines that two-SETs insn with 2 other insns, an AND and a NOT, dropping the SET that modified the REG but still referencing the earlier value of that REG. Then, it attempts to combine the AND and the NOT, but since it still believes the REG held the result of an AND with 1, that simplifies to a XOR with 1. The problem is that the REG no longer holds the result of the AND, but combine failed to detach the REG from the value of the dropped SET. This patch does just that.