From 78d459bbbbadcfe8121106d49e1e6ede3c182c31 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sat, 16 Sep 2017 20:39:01 +0000 Subject: [PATCH] PR82228: Move ncopies calculation in vectorizable_live_operation This should have been after the early exit for non-vectorised statements. 2017-09-16 Richard Sandiford gcc/ PR tree-optimization/82228 * tree-vect-loop.c (vectorizable_live_operation): Move initialization of ncopies. From-SVN: r252888 --- gcc/ChangeLog | 6 ++++++ gcc/tree-vect-loop.c | 10 +++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b5a39b9b0d2..e213db6e2a0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-09-16 Richard Sandiford + + PR tree-optimization/82228 + * tree-vect-loop.c (vectorizable_live_operation): Move initialization + of ncopies. + 2017-09-16 Chung-Ju Wu * common/config/nds32/nds32-common.c diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 80eb4f1fda9..c7cc79fd76d 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -7029,11 +7029,6 @@ vectorizable_live_operation (gimple *stmt, gcc_assert (STMT_VINFO_LIVE_P (stmt_info)); - if (slp_node) - ncopies = 1; - else - ncopies = vect_get_num_copies (loop_vinfo, vectype); - if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def) return false; @@ -7054,6 +7049,11 @@ vectorizable_live_operation (gimple *stmt, return true; } + if (slp_node) + ncopies = 1; + else + ncopies = vect_get_num_copies (loop_vinfo, vectype); + if (!vec_stmt) /* No transformation required. */ return true;