This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, LRA] Remove REG_DEAD and REG_UNUSED notes.


> The description is too terse.  In the RTL middle-end, you shouldn't have to
> manually deal with the REG_DEAD and REG_UNUSED notes (unlike REG_EQUAL and
> REG_EQUIV notes), as the DF framework is supposed to do it for you.

Sorry, for that.  The description of the LRA function update_inc_notes
explicitly says that it removes all the REG_DEAD and REG_UNUSED notes,
but the code didn't do it, and after the LRA pass we indeed still have
that kind of notes, which wasn't the case with reload, and for
instance with the code below:

int f(int x)
{
  return (x >> (sizeof (x) * __CHAR_BIT__ - 1)) ? -1 : 1;
}

we used to have that kind of insns on ARM:

(insn 8 3 27 2 (parallel [
            (set (reg:CC 100 cc)
                (compare:CC (reg:SI 0 r0 [ x ])
                    (const_int 0 [0])))
            (set (reg/v:SI 112 [ x ])
                (reg:SI 0 r0 [ x ]))
        ]) cmp-lra.c:4 205 {*movsi_compare0}
     (expr_list:REG_DEAD (reg:SI 0 r0 [ x ])
        (expr_list:REG_UNUSED (reg:CC 100 cc)
            (nil))))
(insn 27 8 28 2 (set (reg:CC 100 cc)
        (compare:CC (reg/v:SI 112 [ x ])
            (const_int 0 [0]))) cmp-lra.c:4 228 {*arm_cmpsi_insn}
     (expr_list:REG_DEAD (reg/v:SI 112 [ x ])
        (nil)))
(note 28 27 17 2 NOTE_INSN_DELETED)
(insn 17 28 20 2 (set (reg/i:SI 0 r0)
        (if_then_else:SI (ge (reg:CC 100 cc)
                (const_int 0 [0]))
            (const_int 1 [0x1])
            (const_int -1 [0xffffffffffffffff]))) cmp-lra.c:5 249
{*movsicc_insn}
     (expr_list:REG_DEAD (reg:CC 100 cc)
        (nil)))
(insn 20 17 0 2 (use (reg/i:SI 0 r0)) cmp-lra.c:5 -1
     (nil))

with the notes still present after LRA, and the post-reload pass just
drop insns 8 and 27 and the generated code has no more comparison in
it...

Hope it makes more sense, now

Thanks,
Yvan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]