------- Comment #2 from rguenth at gcc dot gnu dot org 2009-07-15 10:54 -------
For me
./xgcc -B. -shared ice.o -flto
takes ages because iterative_hash_gimple_type seems to be exponential in time!?
Called from gimple_register_type on
<pointer_type 0xb7becb60
type <function_type 0xb7becbd0
type <void_type 0xb7cb69a0 VOID
align 8 symtab 0 alias set -1 canonical type 0xb7cb69a0
pointer_to_this <pointer_type 0xb7cb6a10>>
QI
size <integer_cst 0xb7ca9310 constant 8>
unit size <integer_cst 0xb7ca932c constant 1>
align 8 symtab 0 alias set -1 canonical type 0xb7becc40
arg-types <tree_list 0xb7be99a0 value <pointer_type 0xb7bec000>
chain <tree_list 0xb7be99bc value <integer_type 0xb7bd50e0
disp_color_t>
chain <tree_list 0xb7be99d8 value <integer_type 0xb7bd50e0
disp_color_t>
chain <tree_list 0xb7be99f4 value <integer_type 0xb7cb6310>
chain <tree_list 0xb7be9a10 value <integer_type
0xb7cb6310> chain <tree_list 0xb7be9a2c>>>>>>
pointer_to_this <pointer_type 0xb7becb60>>
unsigned SI
size <integer_cst 0xb7ca9498 type <integer_type 0xb7cb6070 bit_size_type>
constant 32>
unit size <integer_cst 0xb7ca9284 type <integer_type 0xb7cb6000> constant
4>
align 32 symtab 0 alias set -1 canonical type 0xb7beccb0>
I guess we should try hashing without duplicates or store the hash somewhere...
I cannot reproduce the ICE btw. A patch to fix the slowness would be
Index: gimple.c
===================================================================
--- gimple.c (revision 149668)
+++ gimple.c (working copy)
@@ -3537,13 +3537,17 @@ gimple_types_compatible_p (tree t1, tree
return same_p;
}
-
/* Returning a hash value for gimple type TYPE combined with VAL. */
static hashval_t
iterative_hash_gimple_type (const_tree type, hashval_t val, unsigned level)
{
hashval_t v;
+ void **slot;
+
+ if ((slot = pointer_map_contains (type_hash_cache, type)) != NULL)
+ return iterative_hash_hashval_t (TREE_ADDRESSABLE (type),
+ (hashval_t) (size_t) *slot);
/* Combine a few common features of types so that types are grouped into
smaller sets; when searching for existing matching types to merge,
@@ -3604,6 +3608,8 @@ iterative_hash_gimple_type (const_tree t
v = iterative_hash_hashval_t (nf, v);
}
+ *pointer_map_insert (type_hash_cache, type) = (void *) (size_t) v;
+
return v;
}
@@ -3620,28 +3626,13 @@ static hashval_t
gimple_type_hash (const void *p)
{
const_tree type;
- void **slot;
- hashval_t v;
type = (const_tree) p;
if (type_hash_cache == NULL)
- {
- type_hash_cache = pointer_map_create ();
- slot = NULL;
- }
- else
- slot = pointer_map_contains (type_hash_cache, type);
+ type_hash_cache = pointer_map_create ();
- if (slot)
- v = (hashval_t) (size_t) *slot;
- else
- {
- v = iterative_hash_gimple_type (type, 0, 0);
- *pointer_map_insert (type_hash_cache, type) = (void *) (size_t) v;
- }
-
- return v;
+ return iterative_hash_gimple_type (type, 0, 0);
}
I am going to bootstrap and test a variant of that.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40758