https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68841
--- Comment #4 from ktkachov at gcc dot gnu.org --- I suspect that more aggressive if-conversion is exposing a bug in another RTL pass. If-conversion creates: (insn 22 21 73 7 (set (reg:CCGC 17 flags) (compare:CCGC (reg/v:SI 88 [ i ]) (const_int 3 [0x3]))) file.c:19 7 {*cmpsi_1} (nil)) (insn 73 22 74 7 (parallel [ (set (reg:SI 94) (ashift:SI (reg/v:SI 88 [ i ]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) zdenek.c:20 525 {*ashlsi3_1} (nil)) (insn 74 73 75 7 (set (reg/v:SI 93 [ k ]) (eq:SI (reg:CCGC 17 flags) (const_int 0 [0]))) file.c:20 626 {*setcc_si_1_movzbl} (nil)) (insn 75 74 76 7 (set (reg:SI 95) (plus:SI (ashift:SI (reg/v:SI 93 [ k ]) (const_int 2 [0x2])) (const_int 8 [0x8]))) file.c:20 212 {*leasi} (nil)) (insn 76 75 77 7 (set (reg:CCGC 17 flags) (compare:CCGC (reg/v:SI 88 [ i ]) (const_int 4 [0x4]))) file.c:20 7 {*cmpsi_1} (nil)) (insn 77 76 33 7 (set (reg/v:SI 87 [ k ]) (if_then_else:SI (lt (reg:CCGC 17 flags) (const_int 0 [0])) (reg:SI 95) (reg:SI 94))) file.c:20 966 {*movsicc_noc} (nil)) but during lr_shrinkage the first compare in insn 22 is deemed dead code and eliminated: (insn 73 21 74 7 (parallel [ (set (reg:SI 94) (ashift:SI (reg/v:SI 88 [ i ]) (const_int 1 [0x1]))) (clobber (reg:CC 17 flags)) ]) file.c:20 525 {*ashlsi3_1} (nil)) (insn 74 73 75 7 (set (reg/v:SI 93 [ k ]) (eq:SI (reg:CCGC 17 flags) (const_int 0 [0]))) file.c:20 626 {*setcc_si_1_movzbl} (expr_list:REG_DEAD (reg:CCGC 17 flags) (nil))) (insn 75 74 76 7 (set (reg:SI 95) (plus:SI (ashift:SI (reg/v:SI 93 [ k ]) (const_int 2 [0x2])) (const_int 8 [0x8]))) file.c:20 212 {*leasi} (expr_list:REG_DEAD (reg/v:SI 93 [ k ]) (nil))) (insn 76 75 77 7 (set (reg:CCGC 17 flags) (compare:CCGC (reg/v:SI 88 [ i ]) (const_int 4 [0x4]))) zdenek.c:20 7 {*cmpsi_1} (nil)) (insn 77 76 33 7 (set (reg/v:SI 87 [ k ]) (if_then_else:SI (lt (reg:CCGC 17 flags) (const_int 0 [0])) (reg:SI 95) (reg:SI 94))) file.c:20 966 {*movsicc_noc} (expr_list:REG_DEAD (reg:SI 95) (expr_list:REG_DEAD (reg:SI 94) (expr_list:REG_DEAD (reg:CCGC 17 flags) (nil))))) However, the result of the comparison had a use in insn 74. I'll dig deeper, but I'm not very familiar with that part of the code, so any insight would be appreciated.