From 8964432ad6f17cef74aa97c367d2975ba9458f92 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 2 May 2019 14:08:08 +0000 Subject: [PATCH] re PR tree-optimization/89653 (Missing vectorization of loop containing std::min/std::max and temporary) 2019-05-02 Richard Biener PR tree-optimization/89653 * tree-ssa-loop.c (pass_data_tree_loop_init): Execute update-address-taken before the pass. * passes.def (pass_tree_loop_init): Put comment before it. * g++.dg/vect/pr89653.cc: New testcase. From-SVN: r270800 --- gcc/ChangeLog | 7 +++++++ gcc/passes.def | 2 ++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/vect/pr89653.cc | 12 ++++++++++++ gcc/tree-ssa-loop.c | 2 +- 5 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/vect/pr89653.cc diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f4f0c14ca25..9149eaad186 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-05-02 Richard Biener + + PR tree-optimization/89653 + * tree-ssa-loop.c (pass_data_tree_loop_init): Execute + update-address-taken before the pass. + * passes.def (pass_tree_loop_init): Put comment before it. + 2019-05-02 Richard Biener PR tree-optimization/89509 diff --git a/gcc/passes.def b/gcc/passes.def index 99640d50091..ad2efabd385 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -255,6 +255,8 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_fix_loops); NEXT_PASS (pass_tree_loop); PUSH_INSERT_PASSES_WITHIN (pass_tree_loop) + /* Before loop_init we rewrite no longer addressed locals into SSA + form if possible. */ NEXT_PASS (pass_tree_loop_init); NEXT_PASS (pass_tree_unswitch); NEXT_PASS (pass_scev_cprop); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3976e36ad4b..bf32f0e756a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-05-02 Richard Biener + + PR tree-optimization/89653 + * g++.dg/vect/pr89653.cc: New testcase. + 2019-05-02 Richard Biener PR tree-optimization/89509 diff --git a/gcc/testsuite/g++.dg/vect/pr89653.cc b/gcc/testsuite/g++.dg/vect/pr89653.cc new file mode 100644 index 00000000000..d38b49a5497 --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr89653.cc @@ -0,0 +1,12 @@ +// { dg-do compile } +// { dg-require-effective-target vect_double } + +#include + +void loop1(double * const __restrict__ vec, double x, int end) +{ + for (int i = 0; i < end; ++i) + vec[i] = std::min(vec[i], vec[i]/x); +} + +// { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c index 00a09508836..1ac6cee60b0 100644 --- a/gcc/tree-ssa-loop.c +++ b/gcc/tree-ssa-loop.c @@ -330,7 +330,7 @@ const pass_data pass_data_tree_loop_init = PROP_cfg, /* properties_required */ 0, /* properties_provided */ 0, /* properties_destroyed */ - 0, /* todo_flags_start */ + TODO_update_address_taken, /* todo_flags_start */ 0, /* todo_flags_finish */ }; -- 2.30.2