diff options
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r-- | gcc/tree-ssa-dse.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c index a8599420763..5fdba8c543b 100644 --- a/gcc/tree-ssa-dse.c +++ b/gcc/tree-ssa-dse.c @@ -199,9 +199,9 @@ dse_possible_dead_store_p (gimple stmt, gimple *use_stmt) post dominates the first store, then the first store is dead. */ static void -dse_optimize_stmt (gimple_stmt_iterator gsi) +dse_optimize_stmt (gimple_stmt_iterator *gsi) { - gimple stmt = gsi_stmt (gsi); + gimple stmt = gsi_stmt (*gsi); /* If this statement has no virtual defs, then there is nothing to do. */ @@ -252,7 +252,7 @@ dse_optimize_stmt (gimple_stmt_iterator gsi) if (dump_file && (dump_flags & TDF_DETAILS)) { fprintf (dump_file, " Deleted dead store '"); - print_gimple_stmt (dump_file, gsi_stmt (gsi), dump_flags, 0); + print_gimple_stmt (dump_file, gsi_stmt (*gsi), dump_flags, 0); fprintf (dump_file, "'\n"); } @@ -261,7 +261,7 @@ dse_optimize_stmt (gimple_stmt_iterator gsi) /* Remove the dead store. */ 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 @@ -277,8 +277,14 @@ dse_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED, { gimple_stmt_iterator gsi; - for (gsi = gsi_last (bb_seq (bb)); !gsi_end_p (gsi); gsi_prev (&gsi)) - dse_optimize_stmt (gsi); + for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi);) + { + dse_optimize_stmt (&gsi); + if (gsi_end_p (gsi)) + gsi = gsi_last_bb (bb); + else + gsi_prev (&gsi); + } } /* Main entry point. */ |