aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-09-09 13:58:45 +0200
committerRichard Biener <rguenther@suse.de>2020-09-09 14:46:14 +0200
commit58905f90434ba9a64abac56324131d67c53910ae (patch)
treed91d7048933759cdac0ecf59ccb39bf37fc53c42 /gcc
parent505590b796df18ec3fcdcd6b8060f6f1410660b2 (diff)
downloadgcc-58905f90434ba9a64abac56324131d67c53910ae.zip
gcc-58905f90434ba9a64abac56324131d67c53910ae.tar.gz
gcc-58905f90434ba9a64abac56324131d67c53910ae.tar.bz2
fix useless unsharing of SLP tree
This avoids unsharing the SLP tree when optimizing load permutations for reductions but there is no actual permute taking place. 2020-09-09 Richard Biener <rguenther@suse.de> * tree-vect-slp.c (vect_attempt_slp_rearrange_stmts): Do nothing when the permutation doesn't permute.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/tree-vect-slp.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index dcc80d5..7860fe3 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1903,11 +1903,14 @@ vect_attempt_slp_rearrange_stmts (slp_instance slp_instn)
}
/* Check that the loads in the first sequence are different and there
- are no gaps between them. */
+ are no gaps between them and that there is an actual permutation. */
+ bool any_permute = false;
auto_sbitmap load_index (group_size);
bitmap_clear (load_index);
FOR_EACH_VEC_ELT (node->load_permutation, i, lidx)
{
+ if (lidx != i)
+ any_permute = true;
if (lidx >= group_size)
return false;
if (bitmap_bit_p (load_index, lidx))
@@ -1915,6 +1918,8 @@ vect_attempt_slp_rearrange_stmts (slp_instance slp_instn)
bitmap_set_bit (load_index, lidx);
}
+ if (!any_permute)
+ return false;
for (i = 0; i < group_size; i++)
if (!bitmap_bit_p (load_index, i))
return false;