diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index c2a2f9653cc22fc97fe9cebd555a8fde9ed11404..05bd2f106a25f5fc0e44e413b256262e3071844a 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -1,3 +1,10 @@ +2009-10-20 Sebastian Pop <sebastian.pop@amd.com> + + * graphite-sese-to-poly.c (pdr_add_data_dimensions): Do not infer + loop upper bounds for 1-element arrays at end of structures. + * tree-flow.h (array_at_struct_end_p): Declared. + * tree-ssa-loop-niter.c (array_at_struct_end_p): Not static anymore. + 2009-10-20 Sebastian Pop <sebastian.pop@amd.com> * g++.dg/graphite/pr41305.C: New. diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 214dc8b006fa2d31e5904fe3be812d03e529566a..b2931d15f497015fc37686e0580c0b7529eea201 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -1728,10 +1728,12 @@ pdr_add_data_dimensions (ppl_Polyhedron_t accesses, data_reference_p dr, high = array_ref_up_bound (ref); - /* high - subscript >= 0 - XXX: 1-element arrays at end of structures may extend over their - declared size. */ - if (high && host_integerp (high, 0)) + /* high - subscript >= 0 */ + if (high && host_integerp (high, 0) + /* 1-element arrays at end of structures may extend over + their declared size. */ + && !(array_at_struct_end_p (ref) + && operand_equal_p (low, high, 0))) { ppl_new_Linear_Expression_with_dimension (&expr, accessp_nb_dims); ppl_set_coef (expr, subscript, -1); diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index bec184d336e6215b4fd2902d272e4d1f2ac67251..96e4aa91281b4e584966e17134f53e70b4dbeae9 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -728,6 +728,7 @@ tree find_loop_niter (struct loop *, edge *); tree loop_niter_by_eval (struct loop *, edge); tree find_loop_niter_by_eval (struct loop *, edge *); void estimate_numbers_of_iterations (void); +bool array_at_struct_end_p (tree); bool scev_probably_wraps_p (tree, tree, gimple, struct loop *, bool); bool convert_affine_scev (struct loop *, tree, tree *, tree *, gimple, bool); diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 14b44aa7ecb81aef8aa7f2750d25b8275cdd5971..d7222104eb5c3b2a7e6497e002460e8e5904b688 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -2612,7 +2612,7 @@ record_nonwrapping_iv (struct loop *loop, tree base, tree step, gimple stmt, allocated structure. If this is the case, the array may be allocated larger than its upper bound implies. */ -static bool +bool array_at_struct_end_p (tree ref) { tree base = get_base_address (ref);