summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-05 21:45:08 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2015-01-05 21:45:08 +0000
commitd8a5b68899bb4013ddc0e62e73dbc97aedef0067 (patch)
tree332cf62cb06a61bcde73d0b785c00583c95a8315
parentb9df73536614fac1bbd4f15e1313c895e4bddaea (diff)
downloadgcc-d8a5b68899bb4013ddc0e62e73dbc97aedef0067.tar.gz
PR tree-optimization/64465
* tree-inline.c (redirect_all_calls): During inlining clean up EH stmts and EH edges if redirect_call_stmt_to_callee changed the stmt to a non-throwing call. * gcc.dg/pr64465.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@219200 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/gcc.dg/pr64465.c22
-rw-r--r--gcc/tree-inline.c12
4 files changed, 41 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index cdf71081426..0557edd8192 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2015-01-05 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/64465
+ * tree-inline.c (redirect_all_calls): During inlining
+ clean up EH stmts and EH edges if redirect_call_stmt_to_callee
+ changed the stmt to a non-throwing call.
+
2015-01-05 Sandra Loosemore <sandra@codesourcery.com>
* doc/invoke.texi: Fix incorrect uses of @code, @option, @samp,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 90c25a5c285..cda42315f16 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2015-01-05 Jakub Jelinek <jakub@redhat.com>
+ PR tree-optimization/64465
+ * gcc.dg/pr64465.c: New test.
+
PR tree-optimization/64494
* gcc.c-torture/compile/pr64494.c: New test.
diff --git a/gcc/testsuite/gcc.dg/pr64465.c b/gcc/testsuite/gcc.dg/pr64465.c
new file mode 100644
index 00000000000..acfa952b00c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr64465.c
@@ -0,0 +1,22 @@
+/* PR tree-optimization/64465 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fexceptions" } */
+
+extern int foo (int *);
+extern int bar (int, int);
+static inline __attribute__ ((__always_inline__))
+int baz (int o)
+{
+ if (__builtin_constant_p (o))
+ return bar (o, 1);
+ return bar (o, 0);
+}
+
+void
+test (void)
+{
+ int s;
+ foo (&s);
+ baz (4);
+ baz (s);
+}
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index e573def60f5..902eb955d39 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -2582,13 +2582,19 @@ void
redirect_all_calls (copy_body_data * id, basic_block bb)
{
gimple_stmt_iterator si;
+ gimple last = last_stmt (bb);
for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
{
- if (is_gimple_call (gsi_stmt (si)))
+ gimple stmt = gsi_stmt (si);
+ if (is_gimple_call (stmt))
{
- struct cgraph_edge *edge = id->dst_node->get_edge (gsi_stmt (si));
+ struct cgraph_edge *edge = id->dst_node->get_edge (stmt);
if (edge)
- edge->redirect_call_stmt_to_callee ();
+ {
+ edge->redirect_call_stmt_to_callee ();
+ if (stmt == last && id->call_stmt && maybe_clean_eh_stmt (stmt))
+ gimple_purge_dead_eh_edges (bb);
+ }
}
}
}