aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.7
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.7')
-rw-r--r--gcc-4.7/ChangeLog.backported9
-rw-r--r--gcc-4.7/gcc/testsuite/g++.dg/torture/pr54563.C14
-rw-r--r--gcc-4.7/gcc/tree-ssa-math-opts.c11
3 files changed, 34 insertions, 0 deletions
diff --git a/gcc-4.7/ChangeLog.backported b/gcc-4.7/ChangeLog.backported
index ffcd5a64e..b6519d034 100644
--- a/gcc-4.7/ChangeLog.backported
+++ b/gcc-4.7/ChangeLog.backported
@@ -1,3 +1,12 @@
+http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=191571
+2012-09-17 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/54563
+ * tree-ssa-math-opts.c (execute_cse_sincos): Call
+ gimple_purge_dead_eh_edges if last call has been changed.
+
+ * g++.dg/torture/pr54563.C: New test.
+
http://gcc.gnu.org/viewcvs?view=revision&revision=193554
2012-11-16 Jakub Jelinek <jakub@redhat.com>
PR target/54073
diff --git a/gcc-4.7/gcc/testsuite/g++.dg/torture/pr54563.C b/gcc-4.7/gcc/testsuite/g++.dg/torture/pr54563.C
new file mode 100644
index 000000000..2980320f6
--- /dev/null
+++ b/gcc-4.7/gcc/testsuite/g++.dg/torture/pr54563.C
@@ -0,0 +1,14 @@
+// PR tree-optimization/54563
+// { dg-do compile }
+
+extern "C" float powf (float, float);
+struct S { ~S (); };
+double bar ();
+double x;
+
+void
+foo ()
+{
+ S s;
+ x = powf (bar (), 2.);
+}
diff --git a/gcc-4.7/gcc/tree-ssa-math-opts.c b/gcc-4.7/gcc/tree-ssa-math-opts.c
index a00541fbd..077e88a63 100644
--- a/gcc-4.7/gcc/tree-ssa-math-opts.c
+++ b/gcc-4.7/gcc/tree-ssa-math-opts.c
@@ -1387,12 +1387,18 @@ execute_cse_sincos (void)
FOR_EACH_BB (bb)
{
gimple_stmt_iterator gsi;
+ bool cleanup_eh = false;
for (gsi = gsi_after_labels (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple stmt = gsi_stmt (gsi);
tree fndecl;
+ /* Only the last stmt in a bb could throw, no need to call
+ gimple_purge_dead_eh_edges if we change something in the middle
+ of a basic block. */
+ cleanup_eh = false;
+
if (is_gimple_call (stmt)
&& gimple_call_lhs (stmt)
&& (fndecl = gimple_call_fndecl (stmt))
@@ -1430,6 +1436,7 @@ execute_cse_sincos (void)
gimple_set_location (new_stmt, loc);
unlink_stmt_vdef (stmt);
gsi_replace (&gsi, new_stmt, true);
+ cleanup_eh = true;
}
break;
@@ -1450,6 +1457,7 @@ execute_cse_sincos (void)
gimple_set_location (new_stmt, loc);
unlink_stmt_vdef (stmt);
gsi_replace (&gsi, new_stmt, true);
+ cleanup_eh = true;
}
break;
@@ -1465,6 +1473,7 @@ execute_cse_sincos (void)
gimple_set_location (new_stmt, loc);
unlink_stmt_vdef (stmt);
gsi_replace (&gsi, new_stmt, true);
+ cleanup_eh = true;
}
break;
@@ -1472,6 +1481,8 @@ execute_cse_sincos (void)
}
}
}
+ if (cleanup_eh)
+ cfg_changed |= gimple_purge_dead_eh_edges (bb);
}
statistics_counter_event (cfun, "sincos statements inserted",