https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83304
--- Comment #9 from Segher Boessenkool <segher at gcc dot gnu.org> --- At some point during combine we have insn_cost 4 for 72: r127:SI=0xffffffffffffff81 insn_cost 4 for 9: r130:SI=ctz(r125:SI) insn_cost 4 for 69: cc:CC=cmp(r125:SI,0) insn_cost 4 for 70: r131:SI={(cc:CC!=0)?r130:SI:0xffffffffffffffff} REG_DEAD r130:SI insn_cost 12 for 16: r133:SI=cc:CC==0 REG_DEAD cc:CC 19: {r134:SI=r131:SI!=0xffffffffffffffff;clobber cc:CC;} REG_UNUSED cc:CC REG_DEAD r131:SI and then it does Trying 70 -> 19: 70: r131:SI={(cc:CC!=0)?r130:SI:0xffffffffffffffff} REG_DEAD r130:SI 19: {r134:SI=r131:SI!=0xffffffffffffffff;clobber cc:CC;} REG_UNUSED cc:CC REG_DEAD r131:SI Failed to match this instruction: (parallel [ (set (reg:SI 134) (ne:SI (reg:CC 100 cc) (const_int 0 [0]))) (clobber (reg:CC 100 cc)) ]) Successfully matched this instruction: (set (reg:SI 134) (ne:SI (reg:CC 100 cc) (const_int 0 [0]))) allowing combination of insns 70 and 19 original costs 4 + 16 = 20 replacement cost 12 deferring deletion of insn with uid = 70. deferring deletion of insn with uid = 9. modifying insn i3 19: r134:SI=cc:CC!=0 REG_DEAD cc:CC deferring rescan insn with uid = 19. but the REG_DEAD note on insn 16 is left, although now 19 uses it too.