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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #3)
> STV converts the register in address:
> 
> (insn 14 56 15 3 (parallel [
>             (set (reg/v:SI 90 [ f ])
>                 (umax:SI (reg/v:SI 92 [ _23 ])
>                     (mem:SI (plus:SI (mult:SI (reg/v:SI 92 [ _23 ])
>                                 (const_int 4 [0x4]))
>                             (symbol_ref:SI ("d") [flags 0x2]  <var_decl
> 0x7f4bf0fcbcf0 d>)) [1 d S4 A32])))
>             (clobber (reg:CC 17 flags))
>         ]) 973 {*umaxsi3_1}
>      (expr_list:REG_UNUSED (reg:CC 17 flags)
>         (nil)))
> 
> which is certainly wrong.

Yes, it does that via general_scalar_chain::make_vector_copies when replacing
all uses:

  for (ref = DF_REG_USE_CHAIN (regno); ref; ref = DF_REF_NEXT_REG (ref))
    if (bitmap_bit_p (insns, DF_REF_INSN_UID (ref)))
      {
        rtx_insn *insn = DF_REF_INSN (ref);
        replace_with_subreg_in_insn (insn, reg, vreg);

        if (dump_file)
          fprintf (dump_file, "  Replaced r%d with r%d in insn %d\n",
                   regno, REGNO (vreg), INSN_UID (insn));
      }

I think we need to disqualify this instruction from being STVed because
of the address-use of the reg.  I've seen code to do that that probably
needs extending to cover {U,S}{MIN,MAX}.  Looking.

Reply via email to