summaryrefslogtreecommitdiff
path: root/gcc/graphite-scop-detection.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-17 16:34:21 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2015-07-17 16:34:21 +0000
commitfc25c6708493bdbf4809f733bc0e68a4ca117ae1 (patch)
treef5c008a61cb11b8aae86f54269a208938816706b /gcc/graphite-scop-detection.c
parent959e7bd02a0ced4a067acbb5a794e200ee3c9b25 (diff)
downloadgcc-fc25c6708493bdbf4809f733bc0e68a4ca117ae1.tar.gz
[graphite] fix pr61929
This fixes bootstrap of GCC with BOOT_CFLAGS="-g -O2 -fgraphite-identity -floop-nest-optimize -floop-block -floop-interchange -floop-strip-mine". It passes regstrap on amd64-linux. A previous change (https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=213816), replaced isl_int with isl_val because isl_int would be deprecated. Since isl_val has stricter checks, it exposed the bug. In the test case (isl_set_max_val) would return infinity which would remain unchecked. We now check if the value returned is an integer or not, and bail out if it isn't. The other problem was that we were allowing all kinds of data-refs in a scop. Now we discard a scop if it has any date-ref other than (ARRAY_REF, MEM_REF, COMPONENT_REF). PR middle-end/61929 * graphite-dependences.c (add_pdr_constraints): Renamed pdr->extent to pdr->subscript_sizes. * graphite-interchange.c (build_linearized_memory_access): Add back all gcc_assert's that the "isl_int to isl_val conversion" patch has removed. Refactored. (pdr_stride_in_loop): Renamed pdr->extent to pdr->subscript_sizes. * graphite-poly.c (new_poly_dr): Same. (free_poly_dr): Same. * graphite-poly.h (struct poly_dr): Same. * graphite-scop-detection.c (stmt_has_simple_data_refs_p): Ignore all data references other than ARRAY_REF, MEM_REF, and COMPONENT_REF. * graphite-scop-detection.h: Fix space. * graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Add back all gcc_assert's removed by a previous patch. (wrap): Remove the_isl_ctx global variable that the same patch has added. (build_loop_iteration_domains): Same. (add_param_constraints): Same. (pdr_add_data_dimensions): Same. Refactored. (build_poly_dr): Renamed extent to subscript_sizes. testsuite/ PR middle-end/61929 * gcc.dg/graphite/pr61929.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225942 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-scop-detection.c')
-rw-r--r--gcc/graphite-scop-detection.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 4fb4e028ac1..28de4ab3a5b 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -289,7 +289,6 @@ stmt_has_simple_data_refs_p (loop_p outermost_loop ATTRIBUTE_UNUSED,
gimple stmt)
{
data_reference_p dr;
- unsigned i;
int j;
bool res = true;
vec<data_reference_p> drs = vNULL;
@@ -302,18 +301,29 @@ stmt_has_simple_data_refs_p (loop_p outermost_loop ATTRIBUTE_UNUSED,
stmt, &drs);
FOR_EACH_VEC_ELT (drs, j, dr)
- for (i = 0; i < DR_NUM_DIMENSIONS (dr); i++)
- if (!graphite_can_represent_scev (DR_ACCESS_FN (dr, i)))
+ {
+ int nb_subscripts = DR_NUM_DIMENSIONS (dr);
+ tree ref = DR_REF (dr);
+
+ for (int i = nb_subscripts - 1; i >= 0; i--)
{
- res = false;
- goto done;
+ if (!graphite_can_represent_scev (DR_ACCESS_FN (dr, i))
+ || (TREE_CODE (ref) != ARRAY_REF
+ && TREE_CODE (ref) != MEM_REF
+ && TREE_CODE (ref) != COMPONENT_REF))
+ {
+ free_data_refs (drs);
+ return false;
+ }
+
+ ref = TREE_OPERAND (ref, 0);
}
+ }
free_data_refs (drs);
drs.create (0);
}
- done:
free_data_refs (drs);
return res;
}