From 9c2390853e656fa61d6af8919e9718f3eb790060 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sun, 11 Dec 2011 22:01:00 +0100 Subject: [PATCH] re PR tree-optimization/51485 (ICE in vectorizable_assignment) PR tree-optimization/51485 * tree-vect-data-refs.c (vect_analyze_data_refs): Give up on DRs in call stmts. * g++.dg/vect/pr51485.cc: New test. From-SVN: r182212 --- gcc/ChangeLog | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/vect/pr51485.cc | 14 ++++++++++++++ gcc/tree-vect-data-refs.c | 20 ++++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 gcc/testsuite/g++.dg/vect/pr51485.cc diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 26df9488ee5..7668767850d 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-12-11 Jakub Jelinek + + PR tree-optimization/51485 + * tree-vect-data-refs.c (vect_analyze_data_refs): Give up on + DRs in call stmts. + 2011-12-11 Patrick Marlier * trans-mem.c (ipa_tm_transform_calls_redirect): Do not remove diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 750983887a6..6f2ce63f207 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-12-11 Jakub Jelinek + + PR tree-optimization/51485 + * g++.dg/vect/pr51485.cc: New test. + 2011-12-11 Tobias Burnus PR fortran/50923 diff --git a/gcc/testsuite/g++.dg/vect/pr51485.cc b/gcc/testsuite/g++.dg/vect/pr51485.cc new file mode 100644 index 00000000000..d57d7596d0e --- /dev/null +++ b/gcc/testsuite/g++.dg/vect/pr51485.cc @@ -0,0 +1,14 @@ +/* { dg-do compile } */ + +struct A { A (); unsigned int a; }; +double bar (A a) throw () __attribute__((pure)); + +void +foo (unsigned int x, double *y, A *z) +{ + unsigned int i; + for (i = 0; i < x; i++) + y[i] = bar (z[i]); +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 8111bdc61ac..6a85b7bf4aa 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2896,6 +2896,26 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo, return false; } + if (is_gimple_call (stmt)) + { + if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) + { + fprintf (vect_dump, "not vectorized: dr in a call "); + print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); + } + + if (bb_vinfo) + { + STMT_VINFO_VECTORIZABLE (stmt_info) = false; + stop_bb_analysis = true; + continue; + } + + if (gather) + free_data_ref (dr); + return false; + } + /* Update DR field in stmt_vec_info struct. */ /* If the dataref is in an inner-loop of the loop that is considered for