diff options
author | Richard Biener <rguenther@suse.de> | 2013-04-04 12:19:30 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2013-04-04 12:19:30 +0000 |
commit | 51a905b2a0b07584d8f7cdce4c5db785efd6f72b (patch) | |
tree | c464cc5b66e76a622c5fe489c540f0f42855d139 /gcc | |
parent | 71879a86efd6404ef36a0493b900868f10808646 (diff) | |
download | gcc-51a905b2a0b07584d8f7cdce4c5db785efd6f72b.zip gcc-51a905b2a0b07584d8f7cdce4c5db785efd6f72b.tar.gz gcc-51a905b2a0b07584d8f7cdce4c5db785efd6f72b.tar.bz2 |
re PR tree-optimization/56213 (strided load vectorization is unnecessarily restricted)
2013-04-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/56213
* tree-vect-data-refs.c (vect_check_strided_load): Remove.
(vect_analyze_data_refs): Allow all non-nested loads as
strided loads.
* gcc.dg/vect/vect-123.c: New testcase.
From-SVN: r197480
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/vect-123.c | 15 | ||||
-rw-r--r-- | gcc/tree-vect-data-refs.c | 56 |
4 files changed, 29 insertions, 54 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8c28100..09f5ff5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2013-04-04 Richard Biener <rguenther@suse.de> + PR tree-optimization/56213 + * tree-vect-data-refs.c (vect_check_strided_load): Remove. + (vect_analyze_data_refs): Allow all non-nested loads as + strided loads. + +2013-04-04 Richard Biener <rguenther@suse.de> + PR tree-optimization/56837 * tree-loop-distribution.c (classify_partition): For non-zero values require that the value has the same precision as its diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0c63f99..a5ec8e2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-04-04 Richard Biener <rguenther@suse.de> + + PR tree-optimization/56213 + * gcc.dg/vect/vect-123.c: New testcase. + 2013-04-04 Tobias Burnus <burnus@net-b.de> PR fortran/56810 diff --git a/gcc/testsuite/gcc.dg/vect/vect-123.c b/gcc/testsuite/gcc.dg/vect/vect-123.c new file mode 100644 index 0000000..5a2f325 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/vect-123.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target vect_int } */ + +int x[4092]; +int y[1024]; + +void foo (int s) +{ + int i, j; + for (i = 0, j = 0; j < 1023; i += s, j++) + y[j] += x[i]; +} + +/* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */ +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index bb0b693..5d07cae 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2816,56 +2816,6 @@ vect_check_gather (gimple stmt, loop_vec_info loop_vinfo, tree *basep, return decl; } -/* Check wether a non-affine load in STMT (being in the loop referred to - in LOOP_VINFO) is suitable for handling as strided load. That is the case - if its address is a simple induction variable. If so return the base - of that induction variable in *BASEP and the (loop-invariant) step - in *STEPP, both only when that pointer is non-zero. - - This handles ARRAY_REFs (with variant index) and MEM_REFs (with variant - base pointer) only. */ - -static bool -vect_check_strided_load (gimple stmt, loop_vec_info loop_vinfo) -{ - struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); - stmt_vec_info stmt_info = vinfo_for_stmt (stmt); - struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info); - tree base, off; - affine_iv iv; - - if (!DR_IS_READ (dr)) - return false; - - base = DR_REF (dr); - - if (TREE_CODE (base) == REALPART_EXPR - || TREE_CODE (base) == IMAGPART_EXPR) - base = TREE_OPERAND (base, 0); - - if (TREE_CODE (base) == ARRAY_REF) - { - off = TREE_OPERAND (base, 1); - base = TREE_OPERAND (base, 0); - } - else if (TREE_CODE (base) == MEM_REF) - { - off = TREE_OPERAND (base, 0); - base = TREE_OPERAND (base, 1); - } - else - return false; - - if (TREE_CODE (off) != SSA_NAME) - return false; - - if (!expr_invariant_in_loop_p (loop, base) - || !simple_iv (loop, loop_containing_stmt (stmt), off, &iv, true)) - return false; - - return true; -} - /* Function vect_analyze_data_refs. Find all the data references in the loop or basic block. @@ -3291,10 +3241,8 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, else if (loop_vinfo && TREE_CODE (DR_STEP (dr)) != INTEGER_CST) { - bool strided_load = false; - if (!nested_in_vect_loop_p (loop, stmt)) - strided_load = vect_check_strided_load (stmt, loop_vinfo); - if (!strided_load) + if (nested_in_vect_loop_p (loop, stmt) + || !DR_IS_READ (dr)) { if (dump_enabled_p ()) { |