diff options
author | Richard Biener <rguenther@suse.de> | 2016-02-22 14:53:17 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2016-02-22 14:53:17 +0000 |
commit | c4e360f44f346e795a671b200d33c61ba187bdcd (patch) | |
tree | 094ddadeeab03967951ed04cda4a3f3868982cd6 /gcc/tree-vect-slp.c | |
parent | 0b1587d4b301a0be08f6a0286619d5d69cb06dd6 (diff) | |
download | gcc-c4e360f44f346e795a671b200d33c61ba187bdcd.zip gcc-c4e360f44f346e795a671b200d33c61ba187bdcd.tar.gz gcc-c4e360f44f346e795a671b200d33c61ba187bdcd.tar.bz2 |
re PR tree-optimization/69882 (Excessive reduction statements generated by SLP)
2016-02-22 Richard Biener <rguenther@suse.de>
PR tree-optimization/69882
* tree-vect-slp.c (vect_attempt_slp_rearrange_stmts): Properly
preserve permutations present because of gaps.
(vect_supported_load_permutation_p): Always continue checking
permutations after vect_attempt_slp_rearrange_stmts.
* gfortran.dg/vect/pr69882.f90: New testcase.
From-SVN: r233605
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r-- | gcc/tree-vect-slp.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 660b14c..988ec10 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -1332,8 +1332,19 @@ vect_attempt_slp_rearrange_stmts (slp_instance slp_instn) node->load_permutation); /* We are done, no actual permutations need to be generated. */ + unsigned int unrolling_factor = SLP_INSTANCE_UNROLLING_FACTOR (slp_instn); FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (slp_instn), i, node) - SLP_TREE_LOAD_PERMUTATION (node).release (); + { + gimple *first_stmt = SLP_TREE_SCALAR_STMTS (node)[0]; + first_stmt = GROUP_FIRST_ELEMENT (vinfo_for_stmt (first_stmt)); + /* But we have to keep those permutations that are required because + of handling of gaps. */ + if (unrolling_factor == 1 + || (group_size == GROUP_SIZE (vinfo_for_stmt (first_stmt)) + && GROUP_GAP (vinfo_for_stmt (first_stmt)) == 0)) + SLP_TREE_LOAD_PERMUTATION (node).release (); + } + return true; } @@ -1381,12 +1392,7 @@ vect_supported_load_permutation_p (slp_instance slp_instn) In reduction chain the order of the loads is not important. */ if (!STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt)) && !GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt))) - { - if (vect_attempt_slp_rearrange_stmts (slp_instn)) - return true; - - /* Fallthru to general load permutation handling. */ - } + vect_attempt_slp_rearrange_stmts (slp_instn); /* In basic block vectorization we allow any subchain of an interleaving chain. |