re PR tree-optimization/69720 (wrong code at -O3 on x86_64-linux-gnu)
2016-02-29 Richard Biener <rguenther@suse.de> PR tree-optimization/69720 * tree-vect-loop.c (get_initial_def_for_reduction): Avoid the adjustment_def path for possibly vectorized defs. (vect_create_epilog_for_reduction): Handle vectorized initial defs properly. * gcc.dg/vect/vect-outer-pr69720.c: New testcase. From-SVN: r233803
This commit is contained in:
parent
a34a94c3ed
commit
6512bc9314
@ -1,3 +1,11 @@
|
||||
2016-02-29 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/69720
|
||||
* tree-vect-loop.c (get_initial_def_for_reduction): Avoid
|
||||
the adjustment_def path for possibly vectorized defs.
|
||||
(vect_create_epilog_for_reduction): Handle vectorized initial
|
||||
defs properly.
|
||||
|
||||
2016-02-28 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* config/i386/cygming.h (STACK_REALIGN_DEFAULT): Define.
|
||||
|
@ -1,3 +1,8 @@
|
||||
2016-02-29 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/69720
|
||||
* gcc.dg/vect/vect-outer-pr69720.c: New testcase.
|
||||
|
||||
2016-02-28 Thomas Koenig <tkoenig@gcc.gnu.org>
|
||||
|
||||
PR fortran/68147
|
||||
|
28
gcc/testsuite/gcc.dg/vect/vect-outer-pr69720.c
Normal file
28
gcc/testsuite/gcc.dg/vect/vect-outer-pr69720.c
Normal file
@ -0,0 +1,28 @@
|
||||
extern void abort (void);
|
||||
|
||||
int a[128];
|
||||
double b[128] = { 1., 2., 3., 4. };
|
||||
|
||||
void __attribute__((noinline)) foo()
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 128; ++i)
|
||||
{
|
||||
double tem1 = b[i];
|
||||
for (int j = 0; j < 32; ++j)
|
||||
tem1 += 1;
|
||||
b[i] = tem1;
|
||||
a[i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
foo ();
|
||||
if (b[0] != 33. || b[1] != 34.
|
||||
|| b[2] != 35. || b[3] != 36.)
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { target { vect_double && vect_int } } } } */
|
@ -4110,6 +4110,15 @@ get_initial_def_for_reduction (gimple *stmt, tree init_val,
|
||||
return vect_create_destination_var (init_val, vectype);
|
||||
}
|
||||
|
||||
/* In case of a nested reduction do not use an adjustment def as
|
||||
that case is not supported by the epilogue generation correctly
|
||||
if ncopies is not one. */
|
||||
if (adjustment_def && nested_in_vect_loop)
|
||||
{
|
||||
*adjustment_def = NULL;
|
||||
return vect_get_vec_def_for_operand (init_val, stmt);
|
||||
}
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case WIDEN_SUM_EXPR:
|
||||
@ -4124,12 +4133,7 @@ get_initial_def_for_reduction (gimple *stmt, tree init_val,
|
||||
/* ADJUSMENT_DEF is NULL when called from
|
||||
vect_create_epilog_for_reduction to vectorize double reduction. */
|
||||
if (adjustment_def)
|
||||
{
|
||||
if (nested_in_vect_loop)
|
||||
*adjustment_def = vect_get_vec_def_for_operand (init_val, stmt);
|
||||
else
|
||||
*adjustment_def = init_val;
|
||||
}
|
||||
*adjustment_def = init_val;
|
||||
|
||||
if (code == MULT_EXPR)
|
||||
{
|
||||
@ -4341,6 +4345,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
|
||||
(in case of SLP, do it for all the phis). */
|
||||
|
||||
/* Get the loop-entry arguments. */
|
||||
enum vect_def_type initial_def_dt = vect_unknown_def_type;
|
||||
if (slp_node)
|
||||
vect_get_vec_defs (reduction_op, NULL_TREE, stmt, &vec_initial_defs,
|
||||
NULL, slp_node, reduc_index);
|
||||
@ -4351,9 +4356,10 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
|
||||
gimple *def_stmt = SSA_NAME_DEF_STMT (reduction_op);
|
||||
initial_def = PHI_ARG_DEF_FROM_EDGE (def_stmt,
|
||||
loop_preheader_edge (loop));
|
||||
vec_initial_defs.create (1);
|
||||
vect_is_simple_use (initial_def, loop_vinfo, &def_stmt, &initial_def_dt);
|
||||
vec_initial_def = get_initial_def_for_reduction (stmt, initial_def,
|
||||
&adjustment_def);
|
||||
vec_initial_defs.create (1);
|
||||
vec_initial_defs.quick_push (vec_initial_def);
|
||||
}
|
||||
|
||||
@ -4368,6 +4374,15 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
|
||||
def = vect_defs[i];
|
||||
for (j = 0; j < ncopies; j++)
|
||||
{
|
||||
if (j != 0)
|
||||
{
|
||||
phi = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (phi));
|
||||
if (nested_in_vect_loop)
|
||||
vec_init_def
|
||||
= vect_get_vec_def_for_stmt_copy (initial_def_dt,
|
||||
vec_init_def);
|
||||
}
|
||||
|
||||
/* Set the loop-entry arg of the reduction-phi. */
|
||||
|
||||
if (STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info)
|
||||
@ -4404,8 +4419,6 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
|
||||
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, SSA_NAME_DEF_STMT (def), 0);
|
||||
dump_printf (MSG_NOTE, "\n");
|
||||
}
|
||||
|
||||
phi = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (phi));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user