------- Additional Comments From jh at suse dot cz  2005-01-01 23:52 -------
Subject: Re:  [4.0 Regression] unrecognisable insn in regclass on x86/amd64

> 
> ------- Additional Comments From pinskia at gcc dot gnu dot org  2005-01-01 
> 22:33 -------
> (In reply to comment #21)
> > This is the original thread which leads to this regession:
> > 
> > http://gcc.gnu.org/ml/gcc/2004-11/threads.html#00839
> 
> If you notice this works on all other targets other than x86/x86_64 which 
> means that it is a latent bug 
> in the x86 back-end.
the problem seems to be loop optimizer taking the 
        (const:SI (plus:SI (symbol_ref:SI ("foo") [flags 0x58] <var_decl 
0xb7d5e828 foo>) (const_int 8 [0x8]))
construct from REG_EQUAL note and throwing it into emit_move_insn
without any care.

I don't think emit_move_insn is required to deal with arbitary constant
operand like this, so it seems to me that correct (and safe) way is to
prevent loop from this idea...  I am testing attached patch.  But we
might also teach move expander to decompose the CONST and legitimize it
as we do for usual variable references...

Honza

Index: loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop.c,v
retrieving revision 1.518
diff -c -3 -p -r1.518 loop.c
*** loop.c      18 Dec 2004 07:55:35 -0000      1.518
--- loop.c      1 Jan 2005 23:47:22 -0000
*************** scan_loop (struct loop *loop, int flags)
*** 1149,1160 ****
                 Otherwise, only use the REG_EQUAL contents if a REG_RETVAL
                 note is present.  */
              temp = find_reg_note (p, REG_EQUIV, NULL_RTX);
!             if (temp)
                src = XEXP (temp, 0), move_insn = 1;
              else
                {
                  temp = find_reg_note (p, REG_EQUAL, NULL_RTX);
!                 if (temp && CONSTANT_P (XEXP (temp, 0)))
                    src = XEXP (temp, 0), move_insn = 1;
                  if (temp && find_reg_note (p, REG_RETVAL, NULL_RTX))
                    {
--- 1149,1161 ----
                 Otherwise, only use the REG_EQUAL contents if a REG_RETVAL
                 note is present.  */
              temp = find_reg_note (p, REG_EQUIV, NULL_RTX);
!             if (temp && general_operand (XEXP (temp, 0), VOIDmode))
                src = XEXP (temp, 0), move_insn = 1;
              else
                {
                  temp = find_reg_note (p, REG_EQUAL, NULL_RTX);
!                 if (temp && CONSTANT_P (XEXP (temp, 0))
!                     && LEGITIMATE_CONSTANT_P (XEXP (temp, 0)))
                    src = XEXP (temp, 0), move_insn = 1;
                  if (temp && find_reg_note (p, REG_RETVAL, NULL_RTX))
                    {


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18910

Reply via email to