graphite-sese-to-poly.c (pdr_add_data_dimensions): Add bounds only for ARRAY_REFs.
2009-09-17 Alexander Monakov <amonakov@ispras.ru> gcc: * graphite-sese-to-poly.c (pdr_add_data_dimensions): Add bounds only for ARRAY_REFs. Use array_ref_{low,up}_bound to determine bounds. libgomp: * testsuite/libgomp.graphite/bounds.c: New test. From-SVN: r151802
This commit is contained in:
parent
07ffa034dd
commit
98f3eb1f98
|
@ -1,3 +1,8 @@
|
||||||
|
2009-09-17 Alexander Monakov <amonakov@ispras.ru>
|
||||||
|
|
||||||
|
* graphite-sese-to-poly.c (pdr_add_data_dimensions): Add bounds only
|
||||||
|
for ARRAY_REFs. Use array_ref_{low,up}_bound to determine bounds.
|
||||||
|
|
||||||
2009-09-17 Martin Jambor <mjambor@suse.cz>
|
2009-09-17 Martin Jambor <mjambor@suse.cz>
|
||||||
|
|
||||||
* common.opt (fipa-sra): New switch.
|
* common.opt (fipa-sra): New switch.
|
||||||
|
|
|
@ -1654,45 +1654,26 @@ pdr_add_data_dimensions (ppl_Polyhedron_t accesses, data_reference_p dr,
|
||||||
{
|
{
|
||||||
tree ref = DR_REF (dr);
|
tree ref = DR_REF (dr);
|
||||||
int i, nb_subscripts = DR_NUM_DIMENSIONS (dr);
|
int i, nb_subscripts = DR_NUM_DIMENSIONS (dr);
|
||||||
tree array_size;
|
|
||||||
HOST_WIDE_INT elt_size;
|
|
||||||
|
|
||||||
array_size = TYPE_SIZE (TREE_TYPE (ref));
|
for (i = nb_subscripts - 1; i >= 0; i--, ref = TREE_OPERAND (ref, 0))
|
||||||
if (array_size == NULL_TREE
|
|
||||||
|| TREE_CODE (array_size) != INTEGER_CST)
|
|
||||||
return;
|
|
||||||
|
|
||||||
elt_size = int_cst_value (array_size);
|
|
||||||
|
|
||||||
for (i = nb_subscripts - 1; i >= 0; i--)
|
|
||||||
{
|
{
|
||||||
ppl_Linear_Expression_t expr;
|
ppl_Linear_Expression_t expr;
|
||||||
ppl_Constraint_t cstr;
|
ppl_Constraint_t cstr;
|
||||||
ppl_dimension_type subscript = dom_nb_dims + 1 + i;
|
ppl_dimension_type subscript = dom_nb_dims + 1 + i;
|
||||||
int size;
|
tree low, high;
|
||||||
|
|
||||||
/* 0 <= subscript */
|
if (TREE_CODE (ref) != ARRAY_REF)
|
||||||
ppl_new_Linear_Expression_with_dimension (&expr, accessp_nb_dims);
|
|
||||||
ppl_set_coef (expr, subscript, 1);
|
|
||||||
ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
|
|
||||||
ppl_Polyhedron_add_constraint (accesses, cstr);
|
|
||||||
ppl_delete_Linear_Expression (expr);
|
|
||||||
ppl_delete_Constraint (cstr);
|
|
||||||
|
|
||||||
ref = TREE_OPERAND (ref, 0);
|
|
||||||
array_size = TYPE_SIZE (TREE_TYPE (ref));
|
|
||||||
if (array_size == NULL_TREE
|
|
||||||
|| TREE_CODE (array_size) != INTEGER_CST)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* subscript <= array_size */
|
low = array_ref_low_bound (ref);
|
||||||
size = elt_size ? int_cst_value (array_size) / elt_size : 0;
|
|
||||||
if (size)
|
/* subscript - low >= 0 */
|
||||||
|
if (host_integerp (low, 0))
|
||||||
{
|
{
|
||||||
ppl_new_Linear_Expression_with_dimension (&expr, accessp_nb_dims);
|
ppl_new_Linear_Expression_with_dimension (&expr, accessp_nb_dims);
|
||||||
ppl_set_coef (expr, subscript, -1);
|
ppl_set_coef (expr, subscript, 1);
|
||||||
|
|
||||||
ppl_set_inhomogeneous (expr, size);
|
ppl_set_inhomogeneous (expr, -int_cst_value (low));
|
||||||
|
|
||||||
ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
|
ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
|
||||||
ppl_Polyhedron_add_constraint (accesses, cstr);
|
ppl_Polyhedron_add_constraint (accesses, cstr);
|
||||||
|
@ -1700,7 +1681,23 @@ pdr_add_data_dimensions (ppl_Polyhedron_t accesses, data_reference_p dr,
|
||||||
ppl_delete_Constraint (cstr);
|
ppl_delete_Constraint (cstr);
|
||||||
}
|
}
|
||||||
|
|
||||||
elt_size = int_cst_value (array_size);
|
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))
|
||||||
|
{
|
||||||
|
ppl_new_Linear_Expression_with_dimension (&expr, accessp_nb_dims);
|
||||||
|
ppl_set_coef (expr, subscript, -1);
|
||||||
|
|
||||||
|
ppl_set_inhomogeneous (expr, int_cst_value (high));
|
||||||
|
|
||||||
|
ppl_new_Constraint (&cstr, expr, PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL);
|
||||||
|
ppl_Polyhedron_add_constraint (accesses, cstr);
|
||||||
|
ppl_delete_Linear_Expression (expr);
|
||||||
|
ppl_delete_Constraint (cstr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
2009-09-17 Alexander Monakov <amonakov@ispras.ru>
|
||||||
|
|
||||||
|
* testsuite/libgomp.graphite/bounds.c: New test.
|
||||||
|
|
||||||
2009-09-11 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
2009-09-11 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
|
||||||
|
|
||||||
* Makefile.am (libgomp_la_LINK): New.
|
* Makefile.am (libgomp_la_LINK): New.
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
int foo(int *a, int n)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
for (i = 2; i < n; i++)
|
||||||
|
a[i] += a[i+1];
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check that Graphite dependency checking notes the dependency. */
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-final { scan-tree-dump-times "0 loops carried no dependency" 1 "graphite" } } */
|
||||||
|
/* { dg-final { cleanup-tree-dump "graphite" } } */
|
||||||
|
/* { dg-final { cleanup-tree-dump "parloops" } } */
|
||||||
|
/* { dg-final { cleanup-tree-dump "optimized" } } */
|
Loading…
Reference in New Issue