re PR debug/43516 ("-fcompare-debug failure" at -O2)

PR debug/43516
	* tree.c (MAX_INT_CACHED_PREC): Define.
	(nonstandard_integer_type_cache): New array.
	(build_nonstandard_integer_type): Cache results for precision
	<= MAX_INT_CACHED_PREC.

From-SVN: r158062
This commit is contained in:
Jakub Jelinek 2010-04-07 16:23:35 +02:00 committed by Jakub Jelinek
parent 0d3c82d66e
commit 1a299ae4f2
2 changed files with 30 additions and 4 deletions

View File

@ -1,3 +1,11 @@
2010-04-07 Jakub Jelinek <jakub@redhat.com>
PR debug/43516
* tree.c (MAX_INT_CACHED_PREC): Define.
(nonstandard_integer_type_cache): New array.
(build_nonstandard_integer_type): Cache results for precision
<= MAX_INT_CACHED_PREC.
2010-04-07 Richard Guenther <rguenther@suse.de>
* doc/invoke.texi (-fargument-alias, -fargument-noalias,

View File

@ -1,6 +1,6 @@
/* Language-independent node constructors for parse phase of GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
Free Software Foundation, Inc.
This file is part of GCC.
@ -6876,6 +6876,10 @@ build_index_type (tree maxval)
}
}
#define MAX_INT_CACHED_PREC \
(HOST_BITS_PER_WIDE_INT > 64 ? HOST_BITS_PER_WIDE_INT : 64)
static GTY(()) tree nonstandard_integer_type_cache[2 * MAX_INT_CACHED_PREC + 2];
/* Builds a signed or unsigned integer type of precision PRECISION.
Used for C bitfields whose precision does not match that of
built-in target types. */
@ -6883,8 +6887,19 @@ tree
build_nonstandard_integer_type (unsigned HOST_WIDE_INT precision,
int unsignedp)
{
tree itype = make_node (INTEGER_TYPE);
tree itype, ret;
if (unsignedp)
unsignedp = MAX_INT_CACHED_PREC + 1;
if (precision <= MAX_INT_CACHED_PREC)
{
itype = nonstandard_integer_type_cache[precision + unsignedp];
if (itype)
return itype;
}
itype = make_node (INTEGER_TYPE);
TYPE_PRECISION (itype) = precision;
if (unsignedp)
@ -6892,10 +6907,13 @@ build_nonstandard_integer_type (unsigned HOST_WIDE_INT precision,
else
fixup_signed_type (itype);
ret = itype;
if (host_integerp (TYPE_MAX_VALUE (itype), 1))
return type_hash_canon (tree_low_cst (TYPE_MAX_VALUE (itype), 1), itype);
ret = type_hash_canon (tree_low_cst (TYPE_MAX_VALUE (itype), 1), itype);
if (precision <= MAX_INT_CACHED_PREC && lang_hooks.types.hash_types)
nonstandard_integer_type_cache[precision + unsignedp] = ret;
return itype;
return ret;
}
/* Create a range of some discrete type TYPE (an INTEGER_TYPE,