https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112760
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|needs-bisection | --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- In reload dump I see no changes (except function_decl/var_decl addresses), in vzeroupper, postreload, split2, ree and cmpelim dumps a bunch of extra REG_DEAD notes here and there in r14-5355 compared to r14-5354, and finally pro_and_epilogue deletes (insn 20 19 62 2 (set (reg:CCZ 17 flags) (compare:CCZ (reg:SI 0 ax [110]) (reg:SI 1 dx [111]))) "pr112760.c":6:22 11 {*cmpsi_1} (expr_list:REG_UNUSED (reg:CCZ 17 flags) (nil))) insn. In reload dump there is: (insn 20 19 44 2 (set (reg:CCZ 17 flags) (compare:CCZ (reg:SI 0 ax [110]) (reg:SI 1 dx [111]))) "pr112760.c":6:22 11 {*cmpsi_1} (nil)) (insn 44 20 62 2 (set (reg:CCZ 17 flags) (compare:CCZ (reg:SI 0 ax [110]) (reg:SI 1 dx [111]))) "pr112760.c":6:22 11 {*cmpsi_1} (nil)) (insn 62 44 46 2 (set (reg:HI 0 ax [118]) (const_int 1 [0x1])) "pr112760.c":6:22 86 {*movhi_internal} (expr_list:REG_EQUIV (const_int 1 [0x1]) (nil))) (insn 46 62 25 2 (set (reg:HI 3 bx [orig:103 _8+2 ] [103]) (if_then_else:HI (eq (reg:CCZ 17 flags) (const_int 0 [0])) (reg:HI 3 bx [orig:103 _8+2 ] [103]) (reg:HI 0 ax [118]))) "pr112760.c":6:22 1381 {*movhicc_noc} (nil)) so the insn 20 is indeed useless and in vzeroupper pass that was correctly marked in the notes: (insn 20 19 44 2 (set (reg:CCZ 17 flags) (compare:CCZ (reg:SI 0 ax [110]) (reg:SI 1 dx [111]))) "pr112760.c":6:22 11 {*cmpsi_1} (expr_list:REG_UNUSED (reg:CCZ 17 flags) (nil))) (insn 44 20 62 2 (set (reg:CCZ 17 flags) (compare:CCZ (reg:SI 0 ax [110]) (reg:SI 1 dx [111]))) "pr112760.c":6:22 11 {*cmpsi_1} (expr_list:REG_DEAD (reg:SI 1 dx [111]) (expr_list:REG_DEAD (reg:SI 0 ax [110]) (nil)))) (insn 62 44 46 2 (set (reg:HI 0 ax [118]) (const_int 1 [0x1])) "pr112760.c":6:22 86 {*movhi_internal} (expr_list:REG_EQUIV (const_int 1 [0x1]) (nil))) (insn 46 62 25 2 (set (reg:HI 3 bx [orig:103 _8+2 ] [103]) (if_then_else:HI (eq (reg:CCZ 17 flags) (const_int 0 [0])) (reg:HI 3 bx [orig:103 _8+2 ] [103]) (reg:HI 0 ax [118]))) "pr112760.c":6:22 1381 {*movhicc_noc} (expr_list:REG_DEAD (reg:CCZ 17 flags) (expr_list:REG_DEAD (reg:HI 0 ax [118]) (nil)))) But then postreload deletes insn 44 rather than 20 and keeps the notes around unchanged. Insn 20 is deleted in #2 0x0000000000cce9df in copyprop_hardreg_forward_1 (bb=<basic_block 0x7fffea2f7c60 (2)>, vd=0x3bd2be0) at ../../gcc/regcprop.cc:829 #3 0x0000000000ccfe1c in copyprop_hardreg_forward_bb_without_debug_insn (bb=<basic_block 0x7fffea2f7c60 (2)>) at ../../gcc/regcprop.cc:1235 #4 0x0000000000d5b371 in prepare_shrink_wrap (entry_block=<basic_block 0x7fffea2f7c60 (2)>) at ../../gcc/shrink-wrap.cc:451 #5 0x0000000000d5bb70 in try_shrink_wrapping (entry_edge=0x7fffffffd900, prologue_seq=0x7fffe9f25240) at ../../gcc/shrink-wrap.cc:674 #6 0x00000000008b4320 in thread_prologue_and_epilogue_insns () at ../../gcc/function.cc:6056 and regcprop.cc documents it relies on up to date REG_DEAD/REG_UNUSED notes; after all the removal happens in /* Detect obviously dead sets (via REG_UNUSED notes) and remove them. */ if (set && !RTX_FRAME_RELATED_P (insn) && NONJUMP_INSN_P (insn) && !may_trap_p (set) && find_reg_note (insn, REG_UNUSED, SET_DEST (set)) && !side_effects_p (SET_SRC (set)) && !side_effects_p (SET_DEST (set))) { bool last = insn == BB_END (bb); delete_insn (insn); if (last) break; continue; } and regcprop.cc calls df_note_add_problem (); before calling df_analyze (). Except in the pro_and_epilogue case it is done elsewhere and it just calls into the regcprop.cc functions.