This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR34706, PR34683 -- use more precise types for fortran arrays
- From: "Janus Weil" <jaydub66 at googlemail dot com>
- To: "Richard Guenther" <rguenther at suse dot de>
- Cc: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Tue, 8 Jan 2008 21:53:06 +0100
- Subject: Re: [PATCH] Fix PR34706, PR34683 -- use more precise types for fortran arrays
- References: <Pine.LNX.4.64.0801081143240.3891@zhemvz.fhfr.qr>
Hi Richard,
thanks for taking care of this. Already the other patches you
committed in connection with PR34683 have helped a bit. With rev.
131401 the test case compiles in about 60sec using 570MB of memory
(with -O1 -fstrict aliasing). This is already significantly better
than the 800MB from before.
After applying your trans-types.c patch, this further improves to
33sec and 440MB. Which is nice, but still way above last years'
October builds. Most of the memory is still used for "tree operand
scan" and "tree FRE". So I guess there still must be something going
wrong.
But I think this patch is fine.
Cheers,
Janus
> 2008-01-08 Richard Guenther <rguenther@suse.de>
>
> PR fortran/34706
> PR tree-optimization/34683
> * trans-types.c (gfc_get_array_type_bounds): Use an array type
> with known size for accesses if that is known.
>
> Index: fortran/trans-types.c
> ===================================================================
> *** fortran/trans-types.c (revision 131372)
> --- fortran/trans-types.c (working copy)
> *************** gfc_get_array_type_bounds (tree etype, i
> *** 1436,1442 ****
> enum gfc_array_kind akind)
> {
> char name[8 + GFC_RANK_DIGITS + GFC_MAX_SYMBOL_LEN];
> ! tree fat_type, base_type, arraytype, lower, upper, stride, tmp;
> const char *typename;
> int n;
>
> --- 1436,1442 ----
> enum gfc_array_kind akind)
> {
> char name[8 + GFC_RANK_DIGITS + GFC_MAX_SYMBOL_LEN];
> ! tree fat_type, base_type, arraytype, lower, upper, stride, tmp, rtype;
> const char *typename;
> int n;
>
> *************** gfc_get_array_type_bounds (tree etype, i
> *** 1511,1520 ****
> /* TODO: known offsets for descriptors. */
> GFC_TYPE_ARRAY_OFFSET (fat_type) = NULL_TREE;
>
> ! /* We define data as an unknown size array. Much better than doing
> ! pointer arithmetic. */
> ! arraytype =
> ! build_array_type (etype, gfc_array_range_type);
> arraytype = build_pointer_type (arraytype);
> GFC_TYPE_ARRAY_DATAPTR_TYPE (fat_type) = arraytype;
>
> --- 1511,1525 ----
> /* TODO: known offsets for descriptors. */
> GFC_TYPE_ARRAY_OFFSET (fat_type) = NULL_TREE;
>
> ! /* We define data as an array with the correct size if possible.
> ! Much better than doing pointer arithmetic. */
> ! if (stride)
> ! rtype = build_range_type (gfc_array_index_type, gfc_index_zero_node,
> ! int_const_binop (MINUS_EXPR, stride,
> ! integer_one_node, 0));
> ! else
> ! rtype = gfc_array_range_type;
> ! arraytype = build_array_type (etype, rtype);
> arraytype = build_pointer_type (arraytype);
> GFC_TYPE_ARRAY_DATAPTR_TYPE (fat_type) = arraytype;