Hi! On Mon, Feb 27, 2023 at 08:11:09PM +0100, Jakub Jelinek wrote: > (insn 52 48 53 2 (set (reg:CC 66 cc) > (compare:CC (reg:SI 130) > (const_int 0 [0]))) "pr108803.c":12:25 437 {cmpsi} > (expr_list:REG_DEAD (reg:SI 130) > (expr_list:REG_EQUAL (compare:CC (const_int -64 [0xffffffffffffffc0]) > (const_int 0 [0])) > (nil)))) > (insn 53 52 57 2 (set (reg:DI 152 [ _6+8 ]) > (if_then_else:DI (ge (reg:CC 66 cc) > (const_int 0 [0])) > (reg:DI 132) > (const_int 0 [0]))) "pr108803.c":12:25 490 {*cmovdi_insn} > (expr_list:REG_DEAD (reg:DI 132) > (nil))) > (insn 57 53 59 2 (set (reg:DI 151 [ _6 ]) > (if_then_else:DI (ge (reg:CC 66 cc) > (const_int 0 [0])) > (const_int 0 [0]) > (reg:DI 126))) "pr108803.c":12:25 490 {*cmovdi_insn} > (expr_list:REG_DEAD (reg:CC 66 cc) > (nil))) > ... > (insn 71 68 72 2 (set (reg:CC 66 cc) > (compare:CC (reg:SI 137) > (const_int 0 [0]))) "pr108803.c":12:42 437 {cmpsi} > (expr_list:REG_DEAD (reg:SI 137) > (expr_list:REG_EQUAL (compare:CC (const_int -64 [0xffffffffffffffc0]) > (const_int 0 [0])) > (nil)))) > (insn 72 71 76 2 (set (reg:DI 153 [ _8 ]) > (if_then_else:DI (ge (reg:CC 66 cc) > (const_int 0 [0])) > (reg:DI 139) > (reg:DI 153 [ _8 ]))) "pr108803.c":12:42 490 {*cmovdi_insn} > (expr_list:REG_DEAD (reg:DI 139) > (nil))) > (insn 76 72 77 2 (set (reg:DI 154 [ _8+8 ]) > (if_then_else:DI (ge (reg:CC 66 cc) > (const_int 0 [0])) > (reg:DI 138) > (reg:DI 127))) "pr108803.c":12:42 490 {*cmovdi_insn} > (expr_list:REG_DEAD (reg:DI 138) > (expr_list:REG_DEAD (reg:DI 127) > (expr_list:REG_DEAD (reg:CC 66 cc) > (nil))))) > (insn 77 76 78 2 (set (reg:DI 159 [ b ]) > (ior:DI (reg:DI 151 [ _6 ]) > (reg:DI 126))) "pr108803.c":12:12 537 {iordi3} > (expr_list:REG_DEAD (reg:DI 126) > (expr_list:REG_DEAD (reg:DI 151 [ _6 ]) > (nil)))) > (insn 78 77 80 2 (set (reg:DI 160 [ b+8 ]) > (reg:DI 152 [ _6+8 ])) "pr108803.c":12:12 65 {*movdi_aarch64} > (expr_list:REG_DEAD (reg:DI 152 [ _6+8 ]) > (nil)))
Both CC's are used twice, in if_then_else all times, a situation that does not happen frequently at all, and that combine is apparently not prepared for at all. It is the same (hard!) register in all cases as well. > but as you can see, because cc reg has been REG_DEAD before on insn 57 > rather than on insn 53, nothing really removed REG_DEAD note from there > and just adds it on insn 78 (note, besides this REG_DEAD issue the > IL is otherwise still sane, the previous cc setter 71 and its previous > uses 72 and 76 in between the move have been optimized away already in > an earlier successful combination). > And things go wild with the next successful combination: Yup. Segher