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

--- Comment #2 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #1)
> Don't have our bisect seed built with --enable-checking=rtl, so can't bisect
> this easily.  But what I see is that this insn is marked as deleted during
> LRA inheritance:
> #0  set_insn_deleted (insn=0x7ffff184f240) at ../../gcc/emit-rtl.c:4116
> #1  0x0000000000bd9c99 in lra_set_insn_deleted (insn=0x7ffff184f240) at
> ../../gcc/lra.c:256
> #2  0x0000000000bf5188 in update_ebb_live_info (head=0x7ffff1726900,
> tail=0x7ffff184f540) at ../../gcc/lra-constraints.c:5263
> #3  0x0000000000bf7236 in lra_inheritance () at
> ../../gcc/lra-constraints.c:5816
> #4  0x0000000000bdeb52 in lra (f=0x0) at ../../gcc/lra.c:2312
> (previously
> (insn 136 140 142 5 (parallel [
>             (set (reg/v:TI 116 [ u128_0 ])
>                 (rotatert:TI (reg/v:TI 116 [ u128_0 ])
>                     (const_int 1 [0x1])))
>             (clobber (reg:CC 17 flags))
>             (clobber (scratch:DI))
>         ]) pr70326.c:14 601 {ix86_rotrti3_doubleword}
>      (expr_list:REG_UNUSED (reg/v:TI 116 [ u128_0 ])
>         (expr_list:REG_UNUSED (reg:CC 17 flags)
>             (nil))))
> ) and then remove_scratches
> 1968    for (i = 0; scratches.iterate (i, &loc); i++)
> 1969      {
> 1970        if (last != loc->insn)
> 1971          {
> 1972            last = loc->insn;
> 1973            id = lra_get_insn_recog_data (last);
> 1974          }
> ICEs because calling lra_get_insn_recog_data on NOTE_INSN_DELETED is not
> supported.  Dunno if we should just ignore deleted insns here, or if we need
> to adjust instead the insn that replaced them, ...

Jakub, I believe we should ignore the deleted insns.  Scratches are part of a
specific insn.  If they are used besides the original insn, they most probably
should not treated as scratches (an always safe way is to ignore that a pseudo
in other insns is created from a scratch from an original insn.  At worst it
gets memory which most probably does not increase stack size as it will be
shared because it is short lived).

There is another topic is how to deal with scratches generated during LRA work,
e.g. PR70030.  Right now it seems to me an improbable situation as reload pass
ignores such situation if I understand its code correctly.

So, you can make a fix ignoring deleted insns.  I am approving the fix.

Thanks.

Reply via email to