https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81803
--- Comment #5 from James Cowgill <james410 at cowgill dot org.uk> --- I have just noticed this which seems curious. Is the 39 -> 40 combine really a valid transformation? It seems we've lost the sign extension and we're just putting a 32-bit value into a 64-bit register without trying to clear the upper bits anymore? Before ----- (insn 38 37 39 3 (set (reg:SI 235) (ne:SI (reg:SI 234 [ h ]) (const_int 0 [0]))) "reduced.c":16 500 {*sne_zero_sisi} (expr_list:REG_DEAD (reg:SI 234 [ h ]) (nil))) (insn 39 38 40 3 (set (reg:HI 233) (subreg:HI (reg:SI 235) 0)) "reduced.c":16 358 {*movhi_internal} (expr_list:REG_DEAD (reg:SI 235) (nil))) (insn 40 39 133 3 (set (reg:DI 207 [ iftmp.3_18 ]) (sign_extend:DI (reg:HI 233))) "reduced.c":16 244 {*extendhidi2_seh} (expr_list:REG_DEAD (reg:HI 233) (nil))) combine ----- Trying 39 -> 40: Successfully matched this instruction: (set (reg:DI 207 [ iftmp.3_18 ]) (subreg:DI (reg:SI 235) 0)) allowing combination of insns 39 and 40 original costs 4 + 4 = 8 replacement cost 4 deferring deletion of insn with uid = 39. modifying insn i3 40: r207:DI=r235:SI#0 REG_DEAD r235:SI deferring rescan insn with uid = 40. Trying 38 -> 40: Successfully matched this instruction: (set (subreg:SI (reg:DI 207 [ iftmp.3_18 ]) 0) (ne:SI (reg:SI 234 [ h ]) (const_int 0 [0]))) allowing combination of insns 38 and 40 original costs 4 + 4 = 8 replacement cost 4 deferring deletion of insn with uid = 38. modifying insn i3 40: r207:DI#0=r234:SI!=0 REG_DEAD r234:SI deferring rescan insn with uid = 40. After ------ (note 38 37 39 3 NOTE_INSN_DELETED) (note 39 38 40 3 NOTE_INSN_DELETED) (insn 40 39 133 3 (set (subreg:SI (reg:DI 207 [ iftmp.3_18 ]) 0) (ne:SI (reg:SI 234 [ h ]) (const_int 0 [0]))) "reduced.c":16 500 {*sne_zero_sisi} (expr_list:REG_DEAD (reg:SI 234 [ h ]) (nil)))