re PR tree-optimization/56826 (Run-fail after r197189.)

2013-04-04  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/56826
	* tree-vect-slp.c (vect_build_slp_tree): Compute ncopies
	more accurately.

	* gcc.dg/vect/pr56826.c: New testcase.
	* gcc.dg/vect/O3-pr36098.c: Adjust.

From-SVN: r197486
This commit is contained in:
Richard Biener 2013-04-04 15:06:44 +00:00 committed by Richard Biener
parent 48f3c26686
commit 314f64eb7d
5 changed files with 60 additions and 5 deletions

View File

@ -1,3 +1,9 @@
2013-04-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/56826
* tree-vect-slp.c (vect_build_slp_tree): Compute ncopies
more accurately.
2013-04-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/56213

View File

@ -1,3 +1,9 @@
2013-04-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/56826
* gcc.dg/vect/pr56826.c: New testcase.
* gcc.dg/vect/O3-pr36098.c: Adjust.
2013-04-04 Tejas Belagod <tejas.belagod@arm.com>
* gcc.target/aarch64/inc/asm-adder-clobber-lr.c: Remove duplication.

View File

@ -17,5 +17,5 @@ void foo (int ncons, t_sortblock *sb, int *iatom)
iatom[m]=sb[i].iatom[m];
}
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" } } */
/* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */

View File

@ -0,0 +1,41 @@
extern void abort (void);
typedef struct {
int a[3];
int num;
} t1;
t1 B[100];
int A[300];
void __attribute__((noinline,noclone))
bar (int *A, t1 *B, int n)
{
int i;
int *a = A;
for (i=0; i<n; i++, a+=3)
{
a[0] = B[i].a[0];
a[1] = B[i].a[1];
a[2] = B[i].a[2];
}
}
int main()
{
int i;
for (i=0; i<100; i++)
{
B[i].num = i;
B[i].a[0] = i * 3;
B[i].a[1] = i * 3 + 1;
B[i].a[2] = i * 3 + 2;
__asm__ volatile ("");
}
bar (&A[0], &B[0], 100);
for (i=0; i<300; i++)
if (A[i] != i)
abort ();
return 0;
}
/* { dg-final { cleanup-tree-dump "vect" } } */

View File

@ -470,7 +470,6 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
tree lhs;
bool stop_recursion = false, need_same_oprnds = false;
tree vectype, scalar_type, first_op1 = NULL_TREE;
unsigned int ncopies;
optab optab;
int icode;
enum machine_mode optab_op2_mode;
@ -577,8 +576,6 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
vectorization_factor = *max_nunits;
}
ncopies = vectorization_factor / TYPE_VECTOR_SUBPARTS (vectype);
if (is_gimple_call (stmt))
{
rhs_code = CALL_EXPR;
@ -741,12 +738,15 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
else
{
/* Load. */
unsigned unrolling_factor
= least_common_multiple
(*max_nunits, group_size) / group_size;
/* FORNOW: Check that there is no gap between the loads
and no gap between the groups when we need to load
multiple groups at once.
??? We should enhance this to only disallow gaps
inside vectors. */
if ((ncopies > 1
if ((unrolling_factor > 1
&& GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) == stmt
&& GROUP_GAP (vinfo_for_stmt (stmt)) != 0)
|| (GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) != stmt
@ -767,6 +767,8 @@ vect_build_slp_tree (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo,
/* Check that the size of interleaved loads group is not
greater than the SLP group size. */
unsigned ncopies
= vectorization_factor / TYPE_VECTOR_SUBPARTS (vectype);
if (loop_vinfo
&& GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) == stmt
&& ((GROUP_SIZE (vinfo_for_stmt (stmt))