aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-math-opts.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-09-17 11:18:35 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2012-09-17 11:18:35 +0200
commit3b9ee1cc734a78aaf343eea4e8a748cbf4a95510 (patch)
treed6bb01d68cea1ccaa62cc403f01e0a9d76919709 /gcc/tree-ssa-math-opts.c
parentb4a642cb4e5152deab0eb2ffd6463a9144f7305f (diff)
downloadgcc-3b9ee1cc734a78aaf343eea4e8a748cbf4a95510.zip
gcc-3b9ee1cc734a78aaf343eea4e8a748cbf4a95510.tar.gz
gcc-3b9ee1cc734a78aaf343eea4e8a748cbf4a95510.tar.bz2
re PR middle-end/54563 (ICE in redirect_eh_edge_1, at tree-eh.c:2215)
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. From-SVN: r191378
Diffstat (limited to 'gcc/tree-ssa-math-opts.c')
-rw-r--r--gcc/tree-ssa-math-opts.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/gcc/tree-ssa-math-opts.c b/gcc/tree-ssa-math-opts.c
index 94d19af..2020bb1 100644
--- a/gcc/tree-ssa-math-opts.c
+++ b/gcc/tree-ssa-math-opts.c
@@ -1,5 +1,5 @@
/* Global, SSA-based optimizations using mathematical identities.
- Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
+ Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of GCC.
@@ -1378,12 +1378,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))
@@ -1421,6 +1427,7 @@ execute_cse_sincos (void)
gimple_set_location (new_stmt, loc);
unlink_stmt_vdef (stmt);
gsi_replace (&gsi, new_stmt, true);
+ cleanup_eh = true;
if (gimple_vdef (stmt))
release_ssa_name (gimple_vdef (stmt));
}
@@ -1443,6 +1450,7 @@ execute_cse_sincos (void)
gimple_set_location (new_stmt, loc);
unlink_stmt_vdef (stmt);
gsi_replace (&gsi, new_stmt, true);
+ cleanup_eh = true;
if (gimple_vdef (stmt))
release_ssa_name (gimple_vdef (stmt));
}
@@ -1460,6 +1468,7 @@ execute_cse_sincos (void)
gimple_set_location (new_stmt, loc);
unlink_stmt_vdef (stmt);
gsi_replace (&gsi, new_stmt, true);
+ cleanup_eh = true;
if (gimple_vdef (stmt))
release_ssa_name (gimple_vdef (stmt));
}
@@ -1469,6 +1478,8 @@ execute_cse_sincos (void)
}
}
}
+ if (cleanup_eh)
+ cfg_changed |= gimple_purge_dead_eh_edges (bb);
}
statistics_counter_event (cfun, "sincos statements inserted",