This is the mail archive of the gcc-bugs@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]

Re: grokfield miscompiled with -O9


On Jan  8, 2000, Richard Henderson <rth@cygnus.com> wrote:

> But I don't understand the intent of the code I've killed, particularly
> in context of the other places this function is called.  It may be that
> this code is correct, but that set_nonzero_bits_and_sign_copies shouldn't
> be using expand_field_assignment.

How about skipping this simplification just while computing
nonzero_bits?

Index: gcc/ChangeLog
from  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>
	
	* combine.c (expand_field_assignment): Do not discard SUBREGs
	while computing nonzero_bits.
	
Index: gcc/combine.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/combine.c,v
retrieving revision 1.107
diff -u -p -r1.107 combine.c
--- gcc/combine.c	2000/01/04 08:01:42	1.107
+++ gcc/combine.c	2000/01/10 03:43:11
@@ -5656,6 +5656,8 @@ expand_field_assignment (x)
       /* A SUBREG between two modes that occupy the same numbers of words
 	 can be done by moving the SUBREG to the source.  */
       else if (GET_CODE (SET_DEST (x)) == SUBREG
+	       /* We need SUBREGs to compute nonzero_bits properly.  */
+	       && nonzero_sign_valid
 	       && (((GET_MODE_SIZE (GET_MODE (SET_DEST (x)))
 		     + (UNITS_PER_WORD - 1)) / UNITS_PER_WORD)
 		   == ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (SET_DEST (x))))


Later on, we may even arrange for set_nonzero_bits_and_sign_copies to
do the appropriate computation for the SUBREG while setting the other
bits as possibly-nonzero.  This can't be worse than what we do now
(i.e., set *all* bits to possibly-nonzero, in this case).

-- 
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them

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