This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Another reload bug


Hello Richard,

I've narrowed down the bug reported as PR optimization/10352, a regression 
from GCC 3.2 present on the 3.2 branch since 3.2.1 (and incidentally also a 
RedHat 9 regression w.r.t RedHat 8 :-) to this patch

2002-10-24  Richard Henderson  <rth at redhat dot com>

	PR opt/7944
	* reload.c (find_reloads_toplev): Use simplify_gen_subreg; mode
	of X is not important when simplifying subregs of constants.


We are trying to reload

	(subreg:SF (reg/v/u:DI 62) 4)

with reg_equiv_constant[regno] == (const_int 0 [0x0]).

But simplify_gen_subreg() can't handle the MODE_INT to MODE_FLOAT conversion: 
we have this line in simplify-rtx.c:simplify_subreg()

	  /* We don't handle synthetizing of non-integral constants yet.  */
	  if (GET_MODE_CLASS (outermode) != MODE_INT)
	    return NULL_RTX;

so we abort.

Now your patch appears to have removed the required conversion code:

Index: reload.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload.c,v
retrieving revision 1.178.2.4.2.3
retrieving revision 1.178.2.4.2.4
diff -u -p -r1.178.2.4.2.3 -r1.178.2.4.2.4
--- reload.c	17 Oct 2002 16:52:27 -0000	1.178.2.4.2.3
+++ reload.c	24 Oct 2002 08:59:49 -0000	1.178.2.4.2.4
@@ -4427,20 +4427,12 @@ find_reloads_toplev (x, opnum, type, ind
 					reg_equiv_constant[regno])) != 0)
 	return tem;
 
-      if (GET_MODE_BITSIZE (GET_MODE (x)) == BITS_PER_WORD
-	  && regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
-	  && reg_equiv_constant[regno] != 0
-	  && (tem = operand_subword (reg_equiv_constant[regno],
-				     SUBREG_BYTE (x) / UNITS_PER_WORD, 0,
-				     GET_MODE (SUBREG_REG (x)))) != 0)
+      if (regno >= FIRST_PSEUDO_REGISTER && reg_renumber[regno] < 0
+	  && reg_equiv_constant[regno] != 0)
 	{
-	  /* TEM is now a word sized constant for the bits from X that
-	     we wanted.  However, TEM may be the wrong representation.
-
-	     Use gen_lowpart_common to convert a CONST_INT into a
-	     CONST_DOUBLE and vice versa as needed according to by the mode
-	     of the SUBREG.  */
-	  tem = gen_lowpart_common (GET_MODE (x), tem);
+	  tem =
+	    simplify_gen_subreg (GET_MODE (x), reg_equiv_constant[regno],
+				 GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x));
 	  if (!tem)
 	    abort ();
 	  return tem;


Should we restore the original code as the "plan B" here?


Note also that the patch lifted the condition

-      if (GET_MODE_BITSIZE (GET_MODE (x)) == BITS_PER_WORD

so this ends up disabling entirely the subsequent block of code.

-- 
Eric Botcazou


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]