re PR tree-optimization/91033 (ICE in vect_analyze_loop, at tree-vect-loop.c:2416)

PR tree-optimization/91033
	* tree-vectorizer.h (vect_mark_stmts_to_be_vectorized,
	vect_analyze_data_refs): Add bool * arguments.
	* tree-vect-data-refs.c (vect_analyze_data_refs): Add fatal argument,
	if failure is due to scatter/gather, set *fatal to false if non-NULL.
	* tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized): Likewise.
	* tree-vect-loop.c (vect_analyze_loop_2): Adjust
	vect_mark_stmts_to_be_vectorized and vect_analyze_data_refs callers.
	* tree-vect-slp.c (vect_slp_analyze_bb_1): Adjust
	vect_analyze_data_refs caller.

	* gcc.target/i386/pr91033.c: New test.

From-SVN: r272989
This commit is contained in:
Jakub Jelinek 2019-07-03 10:25:22 +02:00 committed by Jakub Jelinek
parent 49d0d5fc6f
commit a7b3509eb6
8 changed files with 53 additions and 14 deletions

View File

@ -1,5 +1,16 @@
2019-07-03 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/91033
* tree-vectorizer.h (vect_mark_stmts_to_be_vectorized,
vect_analyze_data_refs): Add bool * arguments.
* tree-vect-data-refs.c (vect_analyze_data_refs): Add fatal argument,
if failure is due to scatter/gather, set *fatal to false if non-NULL.
* tree-vect-stmts.c (vect_mark_stmts_to_be_vectorized): Likewise.
* tree-vect-loop.c (vect_analyze_loop_2): Adjust
vect_mark_stmts_to_be_vectorized and vect_analyze_data_refs callers.
* tree-vect-slp.c (vect_slp_analyze_bb_1): Adjust
vect_analyze_data_refs caller.
* tree-core.h (enum omp_clause_code): Add OMP_CLAUSE__SCANTEMP_
clause.
* tree.h (OMP_CLAUSE_DECL): Use OMP_CLAUSE__SCANTEMP_ instead of

View File

@ -1,3 +1,8 @@
2019-07-03 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/91033
* gcc.target/i386/pr91033.c: New test.
2019-07-03 Bob Duff <duff@adacore.com>
* gnat.dg/task2.adb, gnat.dg/task2_pkg.adb,

View File

@ -0,0 +1,15 @@
/* PR tree-optimization/91033 */
/* { dg-do compile { target pthread } } */
/* { dg-options "-march=knl -O2 -fopenmp-simd -ftree-parallelize-loops=2" } */
#define N 1024
int a[N];
void
foo (void)
{
int i;
#pragma omp simd simdlen (4)
for (i = 0; i < N; ++i)
a[i] = a[i] + 1;
}

View File

@ -4160,7 +4160,7 @@ vect_find_stmt_data_reference (loop_p loop, gimple *stmt,
*/
opt_result
vect_analyze_data_refs (vec_info *vinfo, poly_uint64 *min_vf)
vect_analyze_data_refs (vec_info *vinfo, poly_uint64 *min_vf, bool *fatal)
{
struct loop *loop = NULL;
unsigned int i;
@ -4386,12 +4386,16 @@ vect_analyze_data_refs (vec_info *vinfo, poly_uint64 *min_vf)
as_a <loop_vec_info> (vinfo),
&gs_info)
|| !get_vectype_for_scalar_type (TREE_TYPE (gs_info.offset)))
return opt_result::failure_at
(stmt_info->stmt,
(gatherscatter == GATHER) ?
"not vectorized: not suitable for gather load %G" :
"not vectorized: not suitable for scatter store %G",
stmt_info->stmt);
{
if (fatal)
*fatal = false;
return opt_result::failure_at
(stmt_info->stmt,
(gatherscatter == GATHER)
? "not vectorized: not suitable for gather load %G"
: "not vectorized: not suitable for scatter store %G",
stmt_info->stmt);
}
STMT_VINFO_GATHER_SCATTER_P (stmt_info) = gatherscatter;
}
}

View File

@ -1901,7 +1901,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal, unsigned *n_stmts)
/* Analyze the data references and also adjust the minimal
vectorization factor according to the loads and stores. */
ok = vect_analyze_data_refs (loop_vinfo, &min_vf);
ok = vect_analyze_data_refs (loop_vinfo, &min_vf, &fatal);
if (!ok)
{
if (dump_enabled_p ())
@ -1932,7 +1932,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal, unsigned *n_stmts)
/* Data-flow analysis to detect stmts that do not need to be vectorized. */
ok = vect_mark_stmts_to_be_vectorized (loop_vinfo);
ok = vect_mark_stmts_to_be_vectorized (loop_vinfo, &fatal);
if (!ok)
{
if (dump_enabled_p ())

View File

@ -2861,7 +2861,7 @@ vect_slp_analyze_bb_1 (gimple_stmt_iterator region_begin,
/* Analyze the data references. */
if (!vect_analyze_data_refs (bb_vinfo, &min_vf))
if (!vect_analyze_data_refs (bb_vinfo, &min_vf, NULL))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,

View File

@ -608,7 +608,7 @@ process_use (stmt_vec_info stmt_vinfo, tree use, loop_vec_info loop_vinfo,
This pass detects such stmts. */
opt_result
vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo, bool *fatal)
{
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
@ -778,7 +778,11 @@ vect_mark_stmts_to_be_vectorized (loop_vec_info loop_vinfo)
= process_use (stmt_vinfo, gs_info.offset, loop_vinfo, relevant,
&worklist, true);
if (!res)
return res;
{
if (fatal)
*fatal = false;
return res;
}
}
} /* while worklist */

View File

@ -1501,7 +1501,7 @@ extern unsigned record_stmt_cost (stmt_vector_for_cost *, int,
extern stmt_vec_info vect_finish_replace_stmt (stmt_vec_info, gimple *);
extern stmt_vec_info vect_finish_stmt_generation (stmt_vec_info, gimple *,
gimple_stmt_iterator *);
extern opt_result vect_mark_stmts_to_be_vectorized (loop_vec_info);
extern opt_result vect_mark_stmts_to_be_vectorized (loop_vec_info, bool *);
extern tree vect_get_store_rhs (stmt_vec_info);
extern tree vect_get_vec_def_for_operand_1 (stmt_vec_info, enum vect_def_type);
extern tree vect_get_vec_def_for_operand (tree, stmt_vec_info, tree = NULL);
@ -1559,7 +1559,7 @@ extern bool vect_check_gather_scatter (stmt_vec_info, loop_vec_info,
gather_scatter_info *);
extern opt_result vect_find_stmt_data_reference (loop_p, gimple *,
vec<data_reference_p> *);
extern opt_result vect_analyze_data_refs (vec_info *, poly_uint64 *);
extern opt_result vect_analyze_data_refs (vec_info *, poly_uint64 *, bool *);
extern void vect_record_base_alignments (vec_info *);
extern tree vect_create_data_ref_ptr (stmt_vec_info, tree, struct loop *, tree,
tree *, gimple_stmt_iterator *,