From 1a15be68659f44496aa888750e8ddc63a33bcc6b Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Fri, 13 Jan 2017 23:16:23 -0700 Subject: [PATCH] re PR tree-optimization/33562 (aggregate DSE disabled) PR tree-optimization/33562 PR tree-optimization/61912 PR tree-optimization/77485 * tree-ssa-dse.c (delete_dead_call): Accept gsi rather than a statement. (delete_dead_assignment): Likewise. (dse_dom_walker::dse_optimize_stmt): Pass in the gsi rather than statement to delete_dead_call and delete_dead_assignment. From-SVN: r244461 --- gcc/ChangeLog | 11 +++++++++++ gcc/tree-ssa-dse.c | 18 +++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3c74b193528..d07b1f5ef42 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2017-01-13 Jeff Law + + PR tree-optimization/33562 + PR tree-optimization/61912 + PR tree-optimization/77485 + * tree-ssa-dse.c (delete_dead_call): Accept gsi rather than + a statement. + (delete_dead_assignment): Likewise. + (dse_dom_walker::dse_optimize_stmt): Pass in the gsi rather than + statement to delete_dead_call and delete_dead_assignment. + 2017-01-13 David Malcolm PR c/78304 diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index 20cf3b4c7fd..3ed1596c1f0 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -602,8 +602,9 @@ private: /* Delete a dead call STMT, which is mem* call of some kind. */ static void -delete_dead_call (gimple *stmt) +delete_dead_call (gimple_stmt_iterator *gsi) { + gimple *stmt = gsi_stmt (*gsi); if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, " Deleted dead call: "); @@ -612,13 +613,12 @@ delete_dead_call (gimple *stmt) } tree lhs = gimple_call_lhs (stmt); - gimple_stmt_iterator gsi = gsi_for_stmt (stmt); if (lhs) { tree ptr = gimple_call_arg (stmt, 0); gimple *new_stmt = gimple_build_assign (lhs, ptr); unlink_stmt_vdef (stmt); - if (gsi_replace (&gsi, new_stmt, true)) + if (gsi_replace (gsi, new_stmt, true)) bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index); } else @@ -627,7 +627,7 @@ delete_dead_call (gimple *stmt) unlink_stmt_vdef (stmt); /* Remove the dead store. */ - if (gsi_remove (&gsi, true)) + if (gsi_remove (gsi, true)) bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index); release_defs (stmt); } @@ -636,8 +636,9 @@ delete_dead_call (gimple *stmt) /* Delete a dead store STMT, which is a gimple assignment. */ static void -delete_dead_assignment (gimple *stmt) +delete_dead_assignment (gimple_stmt_iterator *gsi) { + gimple *stmt = gsi_stmt (*gsi); if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, " Deleted dead store: "); @@ -649,9 +650,8 @@ delete_dead_assignment (gimple *stmt) unlink_stmt_vdef (stmt); /* Remove the dead store. */ - gimple_stmt_iterator gsi = gsi_for_stmt (stmt); basic_block bb = gimple_bb (stmt); - if (gsi_remove (&gsi, true)) + if (gsi_remove (gsi, true)) bitmap_set_bit (need_eh_cleanup, bb->index); /* And release any SSA_NAMEs set in this statement back to the @@ -717,7 +717,7 @@ dse_dom_walker::dse_optimize_stmt (gimple_stmt_iterator *gsi) } if (store_status == DSE_STORE_DEAD) - delete_dead_call (stmt); + delete_dead_call (gsi); return; } @@ -760,7 +760,7 @@ dse_dom_walker::dse_optimize_stmt (gimple_stmt_iterator *gsi) && !gimple_clobber_p (use_stmt)) return; - delete_dead_assignment (stmt); + delete_dead_assignment (gsi); } } -- 2.30.2