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
+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,
--- /dev/null
+/* 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;
+}
*/
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;
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;
}
}
/* 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 ())
/* 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 ())
/* 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,
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);
= process_use (stmt_vinfo, gs_info.offset, loop_vinfo, relevant,
&worklist, true);
if (!res)
- return res;
+ {
+ if (fatal)
+ *fatal = false;
+ return res;
+ }
}
} /* while worklist */
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);
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 *,