Hello, Is it necessary for an insn to have REG_UNUSED notes for a CLOBBER? There are lots such notes on x86 for the flags register:
11: {r68:DI=r61:DI<<0x8;clobber flags:CC;} REG_DEAD r61:DI REG_UNUSED flags:CC In most places where the compiler looks at REG_UNUSED notes, it is for an unused result of a SET in a multiple_sets insn. There are a few exceptions, e.g. worker functions for note_stores such as in mode-switching.c:reg_becomes_live(), but that looks more like a mistake than intentional: reg_becomes_live makes non-REG_UNUSED CLOBBERs live but it doesn't calculate REG_UNUSED notes before running so it may be looking at invalid notes, or looking for missing notes. It seems to me that a REG_UNUSED note on a CLOBBER is unnecessary, and it also goes against the documented purpose of a REG_UNUSED note in reg-notes.def: /* Identifies a register set in this insn and never used. */ REG_NOTE (UNUSED) After all, a CLOBBER is not a register set, so I think a patch like the one below is necessary. Thoughts? Ciao! Steven * df-problems.c (df_note_bb_compute): Do not set REG_UNUSED notes on CLOBBERs. Index: df-problems.c =================================================================== --- df-problems.c (revision 196182) +++ df-problems.c (working copy) @@ -3276,11 +3276,12 @@ df_note_bb_compute (unsigned int bb_inde { df_ref def = *def_rec; unsigned int dregno = DF_REF_REGNO (def); - df_create_unused_note (insn, - def, live, artificial_uses, &debug); - if (!DF_REF_FLAGS_IS_SET (def, DF_REF_MUST_CLOBBER | DF_REF_MAY_CLOBBER)) - bitmap_set_bit (do_not_gen, dregno); + { + df_create_unused_note (insn, + def, live, artificial_uses, &debug); + bitmap_set_bit (do_not_gen, dregno); + } if (!DF_REF_FLAGS_IS_SET (def, DF_REF_PARTIAL | DF_REF_CONDITIONAL)) bitmap_clear_bit (live, dregno);