aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2020-04-20 10:05:06 +0200
committerRichard Biener <rguenther@suse.de>2020-06-19 16:43:36 +0200
commit6d8b2ee568bd17a398781d86aab140b8121aad30 (patch)
treecc2cd849f11d0328704cfc72fb8e3686442bfe3c
parenta7a3932e4b698f205273cfa78c7aa8ab6840542a (diff)
downloadgcc-6d8b2ee568bd17a398781d86aab140b8121aad30.zip
gcc-6d8b2ee568bd17a398781d86aab140b8121aad30.tar.gz
gcc-6d8b2ee568bd17a398781d86aab140b8121aad30.tar.bz2
Handle SLP_TREE_LANE_PERMUTATION in scalar costing
This properly handles a lane permutation in scalar costing. For the current only use this doesn't matter much but with permutes that change the number of lanes it will eventually ICE. 2020-06-19 Richard Biener <rguenther@suse.de> * tree-vect-slp.c (vect_bb_slp_scalar_cost): Adjust for lane permutations.
-rw-r--r--gcc/tree-vect-slp.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 84b9727..5c169f3 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -2969,7 +2969,22 @@ vect_bb_slp_scalar_cost (vec_info *vinfo,
{
/* Do not directly pass LIFE to the recursive call, copy it to
confine changes in the callee to the current child/subtree. */
- subtree_life.safe_splice (*life);
+ if (SLP_TREE_CODE (node) == VEC_PERM_EXPR)
+ {
+ subtree_life.safe_grow_cleared (SLP_TREE_LANES (child));
+ for (unsigned j = 0;
+ j < SLP_TREE_LANE_PERMUTATION (node).length (); ++j)
+ {
+ auto perm = SLP_TREE_LANE_PERMUTATION (node)[j];
+ if (perm.first == i)
+ subtree_life[perm.second] = (*life)[j];
+ }
+ }
+ else
+ {
+ gcc_assert (SLP_TREE_LANES (node) == SLP_TREE_LANES (child));
+ subtree_life.safe_splice (*life);
+ }
vect_bb_slp_scalar_cost (vinfo, child, &subtree_life, cost_vec,
visited);
subtree_life.truncate (0);