aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2015-07-05 14:14:41 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2015-07-05 14:14:41 +0200
commit3cc2fa2a17d7d3b72d2140306686c827612234d0 (patch)
tree8b40bbd39e6501bbd3969ee9b32146370f7a5e73 /gcc
parent465c8c1983a68b36059414b7bd589a48693f94e0 (diff)
downloadgcc-3cc2fa2a17d7d3b72d2140306686c827612234d0.zip
gcc-3cc2fa2a17d7d3b72d2140306686c827612234d0.tar.gz
gcc-3cc2fa2a17d7d3b72d2140306686c827612234d0.tar.bz2
re PR tree-optimization/66718 (Non-invariant ADDR_EXPR not vectorized)
PR tree-optimization/66718 * tree-vect-stmts.c (vectorizable_call): Replace uses of GOMP_SIMD_LANE outside of loop with vf - 1 rather than 0. From-SVN: r225434
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/tree-vect-stmts.c24
2 files changed, 28 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4ccf439..13f9ba7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,6 +1,10 @@
2015-07-05 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/66718
+ * tree-vect-stmts.c (vectorizable_call): Replace uses of
+ GOMP_SIMD_LANE outside of loop with vf - 1 rather than 0.
+
+ PR tree-optimization/66718
* tree-vect-stmts.c (vectorizable_assignment, vectorizable_store,
vectorizable_load, vectorizable_condition): Move vectype,
nunits, ncopies computation after checking what kind of statement
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index c656522..5ac7023 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -2601,6 +2601,30 @@ vectorizable_call (gimple gs, gimple_stmt_iterator *gsi, gimple *vec_stmt,
lhs = gimple_call_lhs (STMT_VINFO_RELATED_STMT (stmt_info));
else
lhs = gimple_call_lhs (stmt);
+
+ if (gimple_call_internal_p (stmt)
+ && gimple_call_internal_fn (stmt) == IFN_GOMP_SIMD_LANE)
+ {
+ /* Replace uses of the lhs of GOMP_SIMD_LANE call outside the loop
+ with vf - 1 rather than 0, that is the last iteration of the
+ vectorized loop. */
+ imm_use_iterator iter;
+ use_operand_p use_p;
+ gimple use_stmt;
+ FOR_EACH_IMM_USE_STMT (use_stmt, iter, lhs)
+ {
+ basic_block use_bb = gimple_bb (use_stmt);
+ if (use_bb
+ && !flow_bb_inside_loop_p (LOOP_VINFO_LOOP (loop_vinfo), use_bb))
+ {
+ FOR_EACH_IMM_USE_ON_STMT (use_p, iter)
+ SET_USE (use_p, build_int_cst (TREE_TYPE (lhs),
+ ncopies * nunits_out - 1));
+ update_stmt (use_stmt);
+ }
+ }
+ }
+
new_stmt = gimple_build_assign (lhs, build_zero_cst (type));
set_vinfo_for_stmt (new_stmt, stmt_info);
set_vinfo_for_stmt (stmt, NULL);