Skip to content

Commit 1c19938

Browse files
author
rguenth
committed
2017-08-29 Richard Biener <[email protected]>
Dominik Infuehr <[email protected]> * tree-vect-slp.c (vect_bb_slp_scalar_cost): Properly confine life to the active subtree. * gcc.dg/vect/costmodel/x86_64/costmodel-vect-slp.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@251398 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent a370df2 commit 1c19938

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

gcc/ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2017-08-29 Richard Biener <[email protected]>
2+
Dominik Infuehr <[email protected]>
3+
4+
* tree-vect-slp.c (vect_bb_slp_scalar_cost): Properly confine
5+
life to the active subtree.
6+
17
2017-08-28 Jeff Law <[email protected]>
28

39
* tree-ssa-dom.c (edge_info::record_simple_equiv): Call

gcc/testsuite/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2017-08-29 Richard Biener <[email protected]>
2+
Dominik Infuehr <[email protected]>
3+
4+
* gcc.dg/vect/costmodel/x86_64/costmodel-vect-slp.c: New testcase.
5+
16
2017-08-28 Jeff Law <[email protected]>
27

38
* gcc.dg/torture/pr57214.c: Fix type of loop counter.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/* { dg-do compile } */
2+
/* { dg-additional-options "-fdump-tree-slp-details" } */
3+
4+
#define N 4
5+
6+
int s1[N], s2[N], s3[N];
7+
void escape(int, int, int, int);
8+
9+
void
10+
foo ()
11+
{
12+
int t1, t2, t3, t4;
13+
14+
t1 = s1[0] + s2[0] + s3[0];
15+
t2 = s1[1] + s2[1] + s3[1];
16+
t3 = s1[2] + s2[2] + s3[2];
17+
t4 = s1[3] + s2[3] + s3[3];
18+
19+
s3[0] = t1 - s1[0] * s2[0];
20+
s3[1] = t2 - s1[1] * s2[1];
21+
s3[2] = t3 - s1[2] * s2[2];
22+
s3[3] = t4 - s1[3] * s2[3];
23+
24+
escape (t1, t2, t3, t4);
25+
}
26+
27+
/* { dg-final { scan-tree-dump-not "vectorization is not profitable" "slp2" } } */
28+
/* { dg-final { scan-tree-dump "basic block vectorized" "slp2" } } */

gcc/tree-vect-slp.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2690,9 +2690,18 @@ vect_bb_slp_scalar_cost (basic_block bb,
26902690
scalar_cost += stmt_cost;
26912691
}
26922692

2693+
auto_vec<bool, 20> subtree_life;
26932694
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
2694-
if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
2695-
scalar_cost += vect_bb_slp_scalar_cost (bb, child, life);
2695+
{
2696+
if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
2697+
{
2698+
/* Do not directly pass LIFE to the recursive call, copy it to
2699+
confine changes in the callee to the current child/subtree. */
2700+
subtree_life.safe_splice (*life);
2701+
scalar_cost += vect_bb_slp_scalar_cost (bb, child, &subtree_life);
2702+
subtree_life.truncate (0);
2703+
}
2704+
}
26962705

26972706
return scalar_cost;
26982707
}

0 commit comments

Comments
 (0)