https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78016

--- Comment #3 from Eric Botcazou <ebotcazou at gcc dot gnu.org> ---
> I am wondering whether it's OK to use copy_insn_1 here? that is to replace
> the whole for loop into something simply as "REG_NOTES (new_insn) =
> copy_insn_1 (REG_NOTES (old_insn);"  as I think copy_insn_1 will do
> recursive copy.  This is what's used in old reload1.c.

Yet another way of copying notes...  I didn't know about it but, yes, it looks
well-behaved, albeit a bit heavier than the others.

Ideally we would have a single routine along the other routines in rtlanal.c to
deal with note copying, with a few boolean parameters to drop some of them.

> So copy_insn_1 is safe?

I'd write something more specialized in rtlanal.c instead.

> For the other two places, try_split will just return if the insn is
> RTX_FRAME_RELATED_P, so should be OK.
> 
>   /* We're not good at redistributing frame information.  */
>   if (RTX_FRAME_RELATED_P (trial))
>     return trial;

Yes, maybe try_split can be set aside because it's more of note distribution
than of note copying. 

> While for create_copy_of_insn_rtx in sel-sched-ir.c, I find those historical
> discussion at https://gcc.gnu.org/ml/gcc-patches/2011-12/msg01232.html, it
> was supposed to copy REG_ARGS_SIZE only, later extended to all except
> REG_LABEL_OPERAND/REG_EQUAL/REG_EQUALV.  There is actually no
> mark_jump_label here, so I am thinking the skip of REG_LABEL_OPERAND is
> wrong, while I am not sure if copying REG_EQUAL/REG_EQUALV is wrong.

It's probably a pasto + a sneaky way of dropping REG_EQUAL/REG_EQUAL notes that
have been made invalid by some transformation.

Reply via email to