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

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Uroš Bizjak from comment #7)
> (In reply to H.J. Lu from comment #6)
> > This works:
> > 
> > diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> > index 560e6525b56..f5d46296570 100644
> > --- a/gcc/config/i386/i386.cc
> > +++ b/gcc/config/i386/i386.cc
> > @@ -8494,7 +8494,7 @@ ix86_find_all_reg_use_1 (rtx set, HARD_REG_SET
> > &stack_slot_access,
> >           auto_bitmap &worklist)
> >  {
> >    rtx dest = SET_DEST (set);
> > -  if (!REG_P (dest))
> > +  if (!GENERAL_REG_P (dest))
> >      return;
> >  
> >    rtx src = SET_SRC (set);
> 
> This will prevent the ICE because we have copy from RAX to XMM:
> 
>   170: xmm0:DI=ax:DI
>    98: xmm0:V2DI=vec_duplicate(xmm0:DI)
>       REG_EQUIV vec_duplicate(`g_1680')
>   101: [`g_1679']=xmm0:V2DI
>   103: [const(`g_1679'+0x10)]=xmm0:V2DI
>   105: [const(`g_1679'+0x20)]=xmm0:V2DI
>   107: [const(`g_1679'+0x30)]=xmm0:V2DI
> 
> But does not fix the fact that your algorithm considers these accesses even
> when they are in no way connected to stack or frame pointer. These do not
> even use registers in their address.

The bug is that XMM0 is added to the list of registers which can access stack
and get

  EXECUTE_IF_SET_IN_HARD_REG_SET (stack_slot_access, 0, reg, hrsi)
    for (df_ref ref = DF_REG_USE_CHAIN (reg);
         ref != NULL;
         ref = DF_REF_NEXT_REG (ref))
      {
        if (DF_REF_IS_ARTIFICIAL (ref))
          continue;

        rtx_insn *insn = DF_REF_INSN (ref);

        if (!NONJUMP_INSN_P (insn))
          continue;

        note_stores (insn, ix86_update_stack_alignment,
                     &stack_alignment);
      }

(gdb) call debug_rtx (insn)
(insn 17 15 19 2 (set (mem/c:V2DI (const:DI (plus:DI (symbol_ref:DI ("g_1679")
[flags 0x2] <var_decl 0x7fffe99dc130 g_1679>)
                    (const_int 96 [0x60]))) [4 MEM <vector(2) long unsigned
int> [(volatile struct S1 * * * *)&g_1679 + 96B]+0 S16 A256])
        (reg:V2DI 20 xmm0 [108]))
"/export/home/hjl/bugs/gcc/cvise-1/foo.i":20:23 2400 {movv2di_internal}
     (nil))
(gdb

Reply via email to