This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH][LTO] Fix type hashing for fortran
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Diego Novillo <dnovillo at google dot com>
- Date: Fri, 16 Oct 2009 11:25:34 +0200 (CEST)
- Subject: [PATCH][LTO] Fix type hashing for fortran
This fixes type hashing problems for 465.tonto going from
GIMPLE type table: size 65521, 30282 elements, 385404 searches, 243767715
collisions (ratio: 632.499183)
to
GIMPLE type table: size 65521, 30282 elements, 385404 searches, 201297
collisions (ratio: 0.522301)
and reducing type merging time to less than 1s from several minutes.
The issue was the FE is building a load of local array types with
domains like [0:ubound] and [1:temp]. We should at least distinguish
them during hashing (if not even merging them, or freeing non-constant
bounds during free-lang-data).
Well. I expect this bootstraps and regtests fine - ok if it does?
Thanks,
Richard.
2009-10-16 Richard Guenther <rguenther@suse.de>
* gimple.c (iterative_hash_gimple_type): For integer types
also hash their minimum and maximum values and the string flag.
For array types hash their domain and the string flag.
Index: gcc/gimple.c
===================================================================
*** gcc/gimple.c.orig 2009-10-16 10:55:51.000000000 +0200
--- gcc/gimple.c 2009-10-16 11:17:03.000000000 +0200
*************** iterative_hash_gimple_type (tree type, h
*** 3688,3694 ****
sccstack, sccstate, sccstate_obstack);
}
! /* Recurse for aggregates with a single element. */
if (TREE_CODE (type) == ARRAY_TYPE
|| TREE_CODE (type) == COMPLEX_TYPE
|| TREE_CODE (type) == VECTOR_TYPE)
--- 3688,3711 ----
sccstack, sccstate, sccstate_obstack);
}
! /* For integer types hash the types min/max values and the string flag. */
! if (TREE_CODE (type) == INTEGER_TYPE)
! {
! v = iterative_hash_expr (TYPE_MIN_VALUE (type), v);
! v = iterative_hash_expr (TYPE_MAX_VALUE (type), v);
! v = iterative_hash_hashval_t (TYPE_STRING_FLAG (type), v);
! }
!
! /* For array types hash their domain and the string flag. */
! if (TREE_CODE (type) == ARRAY_TYPE
! && TYPE_DOMAIN (type))
! {
! v = iterative_hash_hashval_t (TYPE_STRING_FLAG (type), v);
! v = visit (TYPE_DOMAIN (type), state, v,
! sccstack, sccstate, sccstate_obstack);
! }
!
! /* Recurse for aggregates with a single element type. */
if (TREE_CODE (type) == ARRAY_TYPE
|| TREE_CODE (type) == COMPLEX_TYPE
|| TREE_CODE (type) == VECTOR_TYPE)