diff options
Diffstat (limited to 'gcc-4.9/gcc/tree-ssa-reassoc.c')
-rw-r--r-- | gcc-4.9/gcc/tree-ssa-reassoc.c | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/gcc-4.9/gcc/tree-ssa-reassoc.c b/gcc-4.9/gcc/tree-ssa-reassoc.c index e9e29e550..fce2a6e20 100644 --- a/gcc-4.9/gcc/tree-ssa-reassoc.c +++ b/gcc-4.9/gcc/tree-ssa-reassoc.c @@ -221,6 +221,35 @@ static struct pointer_map_t *operand_rank; static long get_rank (tree); static bool reassoc_stmt_dominates_stmt_p (gimple, gimple); +/* Wrapper around gsi_remove, which adjusts gimple_uid of debug stmts + possibly added by gsi_remove. */ + +bool +reassoc_remove_stmt (gimple_stmt_iterator *gsi) +{ + gimple stmt = gsi_stmt (*gsi); + + if (!MAY_HAVE_DEBUG_STMTS || gimple_code (stmt) == GIMPLE_PHI) + return gsi_remove (gsi, true); + + gimple_stmt_iterator prev = *gsi; + gsi_prev (&prev); + unsigned uid = gimple_uid (stmt); + basic_block bb = gimple_bb (stmt); + bool ret = gsi_remove (gsi, true); + if (!gsi_end_p (prev)) + gsi_next (&prev); + else + prev = gsi_start_bb (bb); + gimple end_stmt = gsi_stmt (*gsi); + while ((stmt = gsi_stmt (prev)) != end_stmt) + { + gcc_assert (stmt && is_gimple_debug (stmt) && gimple_uid (stmt) == 0); + gimple_set_uid (stmt, uid); + gsi_next (&prev); + } + return ret; +} /* Bias amount for loop-carried phis. We want this to be larger than the depth of any reassociation tree we can see, but not larger than @@ -1123,7 +1152,7 @@ propagate_op_to_single_use (tree op, gimple stmt, tree *def) update_stmt (use_stmt); gsi = gsi_for_stmt (stmt); unlink_stmt_vdef (stmt); - gsi_remove (&gsi, true); + reassoc_remove_stmt (&gsi); release_defs (stmt); } @@ -3072,7 +3101,7 @@ remove_visited_stmt_chain (tree var) { var = gimple_assign_rhs1 (stmt); gsi = gsi_for_stmt (stmt); - gsi_remove (&gsi, true); + reassoc_remove_stmt (&gsi); release_defs (stmt); } else @@ -3494,7 +3523,7 @@ linearize_expr (gimple stmt) update_stmt (stmt); gsi = gsi_for_stmt (oldbinrhs); - gsi_remove (&gsi, true); + reassoc_remove_stmt (&gsi); release_defs (oldbinrhs); gimple_set_visited (stmt, true); @@ -3896,7 +3925,7 @@ repropagate_negates (void) gimple_assign_set_rhs_with_ops (&gsi2, NEGATE_EXPR, x, NULL); user = gsi_stmt (gsi2); update_stmt (user); - gsi_remove (&gsi, true); + reassoc_remove_stmt (&gsi); release_defs (feed); plus_negates.safe_push (gimple_assign_lhs (user)); } @@ -4413,7 +4442,7 @@ reassociate_bb (basic_block bb) reassociations. */ if (has_zero_uses (gimple_get_lhs (stmt))) { - gsi_remove (&gsi, true); + reassoc_remove_stmt (&gsi); release_defs (stmt); /* We might end up removing the last stmt above which places the iterator to the end of the sequence. |