aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dse.c
diff options
context:
space:
mode:
authorPrathamesh Kulkarni <prathamesh.kulkarni@linaro.org>2019-10-28 15:01:24 +0000
committerPrathamesh Kulkarni <prathamesh3492@gcc.gnu.org>2019-10-28 15:01:24 +0000
commit4b0ab0d9588f6c63f7102e70de52684cdda49de8 (patch)
tree0b3bbb28c2906a9e3fcbde687afc7295729329b4 /gcc/tree-ssa-dse.c
parentfa03d5763a91f5061152842c92fbb4e446a3b75f (diff)
downloadgcc-4b0ab0d9588f6c63f7102e70de52684cdda49de8.zip
gcc-4b0ab0d9588f6c63f7102e70de52684cdda49de8.tar.gz
gcc-4b0ab0d9588f6c63f7102e70de52684cdda49de8.tar.bz2
re PR tree-optimization/92163 (ICE: Segmentation fault (in bitmap_set_bit))
2019-10-28 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> PR tree-optimization/92163 * tree-ssa-dse.c (delete_dead_or_redundant_assignment): New param need_eh_cleanup with default value NULL. Gate on need_eh_cleanup before calling bitmap_set_bit. (dse_optimize_redundant_stores): Pass global need_eh_cleanup to delete_dead_or_redundant_assignment. (dse_dom_walker::dse_optimize_stmt): Likewise. * tree-ssa-dse.h (delete_dead_or_redundant_assignment): Adjust prototype. testsuite/ * gcc.dg/tree-ssa/pr92163.c: New test. From-SVN: r277525
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r--gcc/tree-ssa-dse.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index 25cd470..21a15ee 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -77,7 +77,6 @@ along with GCC; see the file COPYING3. If not see
fact, they are the same transformation applied to different views of
the CFG. */
-void delete_dead_or_redundant_assignment (gimple_stmt_iterator *, const char *);
static void delete_dead_or_redundant_call (gimple_stmt_iterator *, const char *);
/* Bitmap of blocks that have had EH statements cleaned. We should
@@ -639,7 +638,8 @@ dse_optimize_redundant_stores (gimple *stmt)
{
gimple_stmt_iterator gsi = gsi_for_stmt (use_stmt);
if (is_gimple_assign (use_stmt))
- delete_dead_or_redundant_assignment (&gsi, "redundant");
+ delete_dead_or_redundant_assignment (&gsi, "redundant",
+ need_eh_cleanup);
else if (is_gimple_call (use_stmt))
delete_dead_or_redundant_call (&gsi, "redundant");
else
@@ -900,7 +900,8 @@ delete_dead_or_redundant_call (gimple_stmt_iterator *gsi, const char *type)
/* Delete a dead store at GSI, which is a gimple assignment. */
void
-delete_dead_or_redundant_assignment (gimple_stmt_iterator *gsi, const char *type)
+delete_dead_or_redundant_assignment (gimple_stmt_iterator *gsi, const char *type,
+ bitmap need_eh_cleanup)
{
gimple *stmt = gsi_stmt (*gsi);
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -915,7 +916,7 @@ delete_dead_or_redundant_assignment (gimple_stmt_iterator *gsi, const char *type
/* Remove the dead store. */
basic_block bb = gimple_bb (stmt);
- if (gsi_remove (gsi, true))
+ if (gsi_remove (gsi, true) && need_eh_cleanup)
bitmap_set_bit (need_eh_cleanup, bb->index);
/* And release any SSA_NAMEs set in this statement back to the
@@ -1059,7 +1060,7 @@ dse_dom_walker::dse_optimize_stmt (gimple_stmt_iterator *gsi)
&& !by_clobber_p)
return;
- delete_dead_or_redundant_assignment (gsi, "dead");
+ delete_dead_or_redundant_assignment (gsi, "dead", need_eh_cleanup);
}
}