On 16.12.2011 0:42, Jakub Jelinek wrote:
On Thu, Dec 15, 2011 at 09:37:45AM -0800, Richard Henderson wrote:
On 12/15/2011 09:32 AM, Jakub Jelinek wrote:
        PR debug/51557
        * sel-sched-ir.c (create_copy_of_insn_rtx): Copy REG_ARGS_SIZE
        notes.

        * gcc.dg/pr51557.c: New test.

There are plenty of other notes that could as well need duplication.
E.g. REG_INC, REG_FRAME_RELATED_EXPR, REG_CFA_*, REG_EH_REGION.

I wasn't sure if it is safe to duplicate them.  I guess most of them are
safe, not sure about REG_EQUAL/REG_EQUIV.
I can certainly try to copy all the notes, e.g.
emit_copy_of_insn_after seems to copy all of them but REG_LABEL_OPERAND.
We need to clone only those insns that are safe. In sel-sched-ir.c:init_global_and_expr_for_insn we check a number of conditions that indicate the insn being un-copyable (force_unique_p is set to true for those; the relevant code starts from line 2954). Previously I fixed this about a year ago wrt prologue and epilogue insns, you can check the thread with the http://gcc.gnu.org/ml/gcc-patches/2010-10/msg00013.html message.

Thus, if an insn has any note that prevents it from being cloned, we need to fix the above place. (If an insn should not even be moved from its block, then CANT_MOVE should be set to 1 in the same function.) Then create_copy_of_insn_rtx can safely copy all the notes as we already know that only clonable insns get to this function. The REG_EQUAL/REG_EQUIV notes may be dropped -- I thought these are supposed to be recomputed by df these days, am I wrong?

Jakub, I am happy to prepare a patch along these lines and to adjust it to mark un-copyable the insns with any notes you or Richard think may be problematic. It would also be great to have this information recorded in a general helper in rtlanal.c or somewhere, so we don't have to guess every time this comes up; what do you think?

Andrey


        Jakub

Reply via email to