This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [PATCH, PR 41112] Do not SRA arrays with non-contant domain bounds


On Wed, 2 Sep 2009, Martin Jambor wrote:

> Hi,
> 
> the patch below fixes PR 41112 by simply not scalarizing arrays with
> domain bounds which are not integer constants.
> 
> I have asked for a testcase addition in the bugzilla since I don't
> really know where to put it.  I got freaked out that there is no
> pr<number> file in gcc/testsuite/gnats.dg and thus have reasons to
> believe it should go someplace else.
> 
> I have just bootstrapped and regression tested this on x86_64-linux,
> obviously including Ada, revision 151322 (i.e. after VTA).
> 
> OK for trunk?

Hmm.  I would have expected the array to be disqualified once we
come along an ARRAY_REF/ARRAY_RANGE_REF with non-constant and non-NULL
operand 2.  With the attached patch you no longer scalarize
struct { int i; int array[x..y]; } if only i is ever accessed.

So - why is this check necessary?  Maybe the disqualification is
not done properly?

Thanks,
Richard.

> Thanks,
> 
> Martin
> 
> 
> 
> 2009-09-02  Martin Jambor  <mjambor@suse.cz>
> 
> 	* tree-sra.c (type_internals_preclude_sra_p): Disqualify array
> 	types with non-constant domain bounds.
> 
> Index: mine/gcc/tree-sra.c
> ===================================================================
> --- mine.orig/gcc/tree-sra.c
> +++ mine/gcc/tree-sra.c
> @@ -548,6 +548,8 @@ type_internals_preclude_sra_p (tree type
>        return false;
>  
>      case ARRAY_TYPE:
> +      if (TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) != INTEGER_CST)
> +	return false;
>        et = TREE_TYPE (type);
>  
>        if (AGGREGATE_TYPE_P (et))
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 - GF: Markus Rex


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