diff options
Diffstat (limited to 'gcc/tree-if-conv.c')
-rw-r--r-- | gcc/tree-if-conv.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index dd11d80..fc894eb 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -2973,9 +2973,11 @@ ifcvt_local_dce (class loop *loop) } } /* Delete dead statements. */ - gsi = gsi_start_bb (bb); + gsi = gsi_last_bb (bb); while (!gsi_end_p (gsi)) { + gimple_stmt_iterator gsiprev = gsi; + gsi_prev (&gsiprev); stmt = gsi_stmt (gsi); if (gimple_store_p (stmt)) { @@ -2986,14 +2988,13 @@ ifcvt_local_dce (class loop *loop) if (dse_classify_store (&write, stmt, false, NULL, NULL, latch_vdef) == DSE_STORE_DEAD) delete_dead_or_redundant_assignment (&gsi, "dead"); - else - gsi_next (&gsi); + gsi = gsiprev; continue; } if (gimple_plf (stmt, GF_PLF_2)) { - gsi_next (&gsi); + gsi = gsiprev; continue; } if (dump_file && (dump_flags & TDF_DETAILS)) @@ -3003,6 +3004,7 @@ ifcvt_local_dce (class loop *loop) } gsi_remove (&gsi, true); release_defs (stmt); + gsi = gsiprev; } } |