https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117095
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I'm afraid we are back to the REG_UNUSED mess :( The equivalence that pseudo 165 is 1 is recorded in cse.cc (record_jump_cond) called from record_jump_equiv. This is guarded by /* If this is a conditional jump insn, record any known equivalences due to the condition being tested. */ insn = BB_END (bb); if (path_entry < path_size - 1 && EDGE_COUNT (bb->succs) == 2 && JUMP_P (insn) && single_set (insn) && any_condjump_p (insn)) { basic_block next_bb = ebb_data->path[path_entry + 1].bb; bool taken = (next_bb == BRANCH_EDGE (bb)->dest); record_jump_equiv (insn, taken); } That the insn has a single set (the pc_set) is a reasonable precondition of the optimization, it doesn't really walk further sets and try to figure out how they affect the result. But the insn is (jump_insn 217 78 216 10 (parallel [ (set (pc) (if_then_else (ne (reg:SI 165) (const_int 1 [0x1])) (label_ref 216) (pc))) (set (reg:SI 165) (plus:SI (reg:SI 165) (const_int -1 [0xffffffffffffffff]))) (clobber (scratch:SI)) (clobber (reg:CC 33 %cc)) ]) "pr117095.c":14:17 discrim 1 2192 {doloop_si64} (expr_list:REG_UNUSED (reg:SI 165) (expr_list:REG_UNUSED (reg:CC 33 %cc) (int_list:REG_BR_PROB 955630228 (nil)))) and because of the REG_UNUSED note (note, it actually even isn't stale, cse.cc has df_note_add_problem (); right before df_analyze ()) single_set returns non-NULL. But we actually want to extend the lifetime of the pseudo if the recorded equivalence is ever used, so we need to disregard REG_UNUSED notes there. I think this got broken with r0-77890, before that record_jump_equiv was done in cse_insn and guarded on n_sets == 1.