diff options
author | Richard Guenther <rguenther@suse.de> | 2012-02-20 15:15:52 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-02-20 15:15:52 +0000 |
commit | a7ce6ec39314e69d2789bf4175983fb687225006 (patch) | |
tree | 52b584af322306a457efe446b5f1f3d74618ee07 | |
parent | b0408f13d4b3170e5dc50149f042f21d1527767d (diff) | |
download | gcc-a7ce6ec39314e69d2789bf4175983fb687225006.zip gcc-a7ce6ec39314e69d2789bf4175983fb687225006.tar.gz gcc-a7ce6ec39314e69d2789bf4175983fb687225006.tar.bz2 |
re PR tree-optimization/52298 (ICE: verify_ssa failed: definition in block follows use)
2012-02-20 Richard Guenther <rguenther@suse.de>
PR tree-optimization/52298
* tree-vect-stmts.c (vectorizable_store): Properly use
STMT_VINFO_DR_STEP instead of DR_STEP when vectorizing
outer loops.
(vectorizable_load): Likewise.
* tree-vect-data-refs.c (vect_analyze_data_ref_access):
Access DR_STEP after ensuring it is not NULL.
* gcc.dg/torture/pr52298.c: New testcase.
* gcc.dg/vect/pr52298.c: Likewise.
From-SVN: r184396
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr52298.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr52298.c | 31 | ||||
-rw-r--r-- | gcc/tree-vect-data-refs.c | 3 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.c | 11 |
6 files changed, 73 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index de00a9d..b8366f4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2012-02-20 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/52298 + * tree-vect-stmts.c (vectorizable_store): Properly use + STMT_VINFO_DR_STEP instead of DR_STEP when vectorizing + outer loops. + (vectorizable_load): Likewise. + * tree-vect-data-refs.c (vect_analyze_data_ref_access): + Access DR_STEP after ensuring it is not NULL. + 2012-02-20 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/52286 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 89d7bb0..caa8eb1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2012-02-20 Richard Guenther <rguenther@suse.de> + + PR tree-optimization/52298 + * gcc.dg/torture/pr52298.c: New testcase. + * gcc.dg/vect/pr52298.c: Likewise. + 2012-02-20 Georg-Johann Lay <avr@gjlay.de> * gcc.dg/pr52132.c: Fix FAIL on 16-bit int platforms. diff --git a/gcc/testsuite/gcc.dg/torture/pr52298.c b/gcc/testsuite/gcc.dg/torture/pr52298.c new file mode 100644 index 0000000..f0799c1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr52298.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +int a, b, c, h; + +int i[5][5]; + +void +fn1 () +{ + int l = 0; + + for (a = 0; a <= 3; a++) + for (b = 1; b >= 0; b -= 1) + l |= i[0][b]; + c = l; +} diff --git a/gcc/testsuite/gcc.dg/vect/pr52298.c b/gcc/testsuite/gcc.dg/vect/pr52298.c new file mode 100644 index 0000000..c240160 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr52298.c @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-options "-O1 -ftree-vectorize -fno-tree-pre -fno-tree-loop-im" } */ + +extern void abort (void); +int c[80]; + +__attribute__((noinline)) int +foo (void) +{ + int l = 0; + int a, b; + + for (a = 3; a >= 0; a--) + for (b = 7; b >= 0; b--) + l |= c[a+60]; + return l; +} + +int +main () +{ + int i; + for (i = 0; i < 60; i++) + c[i] = 1; + for (; i < 64; i++) + c[i] = 1 << (i - 59); + if (foo () != 30) + abort (); + return 0; +} + diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 43f7662..b7d0cb5 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2319,7 +2319,7 @@ vect_analyze_data_ref_access (struct data_reference *dr) stmt_vec_info stmt_info = vinfo_for_stmt (stmt); loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); struct loop *loop = NULL; - HOST_WIDE_INT dr_step = TREE_INT_CST_LOW (step); + HOST_WIDE_INT dr_step; if (loop_vinfo) loop = LOOP_VINFO_LOOP (loop_vinfo); @@ -2332,6 +2332,7 @@ vect_analyze_data_ref_access (struct data_reference *dr) } /* Allow invariant loads in loops. */ + dr_step = TREE_INT_CST_LOW (step); if (loop_vinfo && dr_step == 0) { GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) = NULL; diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 20f10f3..f0b3dae 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -3753,7 +3753,9 @@ vectorizable_store (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, if (!STMT_VINFO_DATA_REF (stmt_info)) return false; - if (tree_int_cst_compare (DR_STEP (dr), size_zero_node) < 0) + if (tree_int_cst_compare (loop && nested_in_vect_loop_p (loop, stmt) + ? STMT_VINFO_DR_STEP (stmt_info) : DR_STEP (dr), + size_zero_node) < 0) { if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "negative step for store."); @@ -4266,7 +4268,10 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, if (!STMT_VINFO_DATA_REF (stmt_info)) return false; - negative = tree_int_cst_compare (DR_STEP (dr), size_zero_node) < 0; + negative = tree_int_cst_compare (loop && nested_in_vect_loop_p (loop, stmt) + ? STMT_VINFO_DR_STEP (stmt_info) + : DR_STEP (dr), + size_zero_node) < 0; if (negative && ncopies > 1) { if (vect_print_dump_info (REPORT_DETAILS)) @@ -4654,7 +4659,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, nested within an outer-loop that is being vectorized. */ if (loop && nested_in_vect_loop_p (loop, stmt) - && (TREE_INT_CST_LOW (DR_STEP (dr)) + && (TREE_INT_CST_LOW (STMT_VINFO_DR_STEP (stmt_info)) % GET_MODE_SIZE (TYPE_MODE (vectype)) != 0)) { gcc_assert (alignment_support_scheme != dr_explicit_realign_optimized); |