aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIra Rosen <irar@il.ibm.com>2010-09-14 09:21:15 +0000
committerIra Rosen <irar@gcc.gnu.org>2010-09-14 09:21:15 +0000
commit5a2c19863869535ff6487951a5732adb114bfb4a (patch)
tree6da9c4af4cb3e9b8356610815ee0416a055f567b /gcc
parent2f78283b38be196f4c8050688853404d41e7d8d1 (diff)
downloadgcc-5a2c19863869535ff6487951a5732adb114bfb4a.zip
gcc-5a2c19863869535ff6487951a5732adb114bfb4a.tar.gz
gcc-5a2c19863869535ff6487951a5732adb114bfb4a.tar.bz2
re PR tree-optimization/45470 (ICE: verify_flow_info failed: BB 2 can not throw but has an EH edge with -ftree-vectorize -fnon-call-exceptions)
PR tree-optimization/45470 * tree-vect-data-refs.c (vect_analyze_data_refs): Fail if a statement can throw an exception. * tree-vect-stmts.c (vectorizable_call): Likewise. From-SVN: r164270
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/vect/pr45470-a.cc24
-rw-r--r--gcc/testsuite/g++.dg/vect/pr45470-b.cc52
-rw-r--r--gcc/tree-vect-data-refs.c11
-rw-r--r--gcc/tree-vect-stmts.c3
6 files changed, 103 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8a42db2..062d25b 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2010-09-14 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/45470
+ * tree-vect-data-refs.c (vect_analyze_data_refs): Fail if a statement
+ can throw an exception.
+ * tree-vect-stmts.c (vectorizable_call): Likewise.
+
2010-09-14 DJ Delorie <dj@redhat.com>
PR target/44749
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index aaf031b..56b953c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2010-09-14 Ira Rosen <irar@il.ibm.com>
+
+ PR tree-optimization/45470
+ * g++.dg/vect/pr45470-a.cc: New test.
+ * g++.dg/vect/pr45470-a.cc: New test.
+
2010-09-10 Jack Howarth <howarth@bromo.med.uc.edu>
PR target/42070
diff --git a/gcc/testsuite/g++.dg/vect/pr45470-a.cc b/gcc/testsuite/g++.dg/vect/pr45470-a.cc
new file mode 100644
index 0000000..474f3d6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr45470-a.cc
@@ -0,0 +1,24 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-vectorize -fnon-call-exceptions" } */
+
+struct A
+{
+ A (): a (0), b (0), c (0)
+ {
+ };
+ ~A ();
+ int a, b, c;
+};
+
+struct B
+{
+ B ();
+ A a1;
+ A a2;
+};
+
+B::B ()
+{
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/testsuite/g++.dg/vect/pr45470-b.cc b/gcc/testsuite/g++.dg/vect/pr45470-b.cc
new file mode 100644
index 0000000..279a1899
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr45470-b.cc
@@ -0,0 +1,52 @@
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftree-vectorize -fno-vect-cost-model -fnon-call-exceptions" } */
+
+template < typename _Tp > struct new_allocator
+{
+ typedef _Tp * pointer;
+ template < typename > struct rebind
+ {
+ typedef new_allocator other;
+ };
+
+};
+
+template < typename _Tp > struct allocator:public new_allocator < _Tp >
+{};
+
+template < typename _Tp, typename _Alloc > struct _Vector_base
+{
+ typedef typename _Alloc::template rebind < _Tp >::other _Tp_alloc_type;
+ struct
+ {
+ typename _Tp_alloc_type::pointer _M_start;
+ typename _Tp_alloc_type::pointer _M_finish;
+ typename _Tp_alloc_type::pointer _M_end_of_storage;
+ };
+
+};
+
+template
+ <
+ typename
+ _Tp,
+ typename
+ _Alloc = allocator < _Tp > >struct vector:_Vector_base < _Tp, _Alloc >
+{
+ typedef _Vector_base < _Tp, _Alloc > _Base;
+ vector ():_Base ()
+ {}
+ ~vector ();
+}
+;
+struct LoadGraph
+{
+ LoadGraph (int);
+ vector < struct _GdkColor >colors;
+ vector < float >data_block;
+};
+
+LoadGraph::LoadGraph (int)
+{}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index ff4f0db..264a107 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -2542,6 +2542,17 @@ vect_analyze_data_refs (loop_vec_info loop_vinfo,
offset = unshare_expr (DR_OFFSET (dr));
init = unshare_expr (DR_INIT (dr));
+ if (stmt_could_throw_p (stmt))
+ {
+ if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS))
+ {
+ fprintf (vect_dump, "not vectorized: statement can throw an "
+ "exception ");
+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
+ }
+ 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
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 6d15bda..5069c9e 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -1343,6 +1343,9 @@ vectorizable_call (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt)
if (TREE_CODE (gimple_call_lhs (stmt)) != SSA_NAME)
return false;
+ if (stmt_could_throw_p (stmt))
+ return false;
+
vectype_out = STMT_VINFO_VECTYPE (stmt_info);
/* Process function arguments. */