diff options
author | Aldy Hernandez <aldyh@redhat.com> | 2020-04-27 09:38:45 +0200 |
---|---|---|
committer | Aldy Hernandez <aldyh@redhat.com> | 2020-04-28 10:08:18 +0200 |
commit | e8fd51064cbeed09a246dd95b3c6ad9099283155 (patch) | |
tree | 40b26b3545c9ca699c967f155bb466ae118a4a49 | |
parent | 413b5adf6ae9e062c6f5804c18d6520d867b996e (diff) | |
download | gcc-e8fd51064cbeed09a246dd95b3c6ad9099283155.zip gcc-e8fd51064cbeed09a246dd95b3c6ad9099283155.tar.gz gcc-e8fd51064cbeed09a246dd95b3c6ad9099283155.tar.bz2 |
Minor cleanups to propagate engine to make dumps more readable.
-rw-r--r-- | gcc/tree-ssa-propagate.c | 35 | ||||
-rw-r--r-- | gcc/vr-values.c | 10 |
2 files changed, 31 insertions, 14 deletions
diff --git a/gcc/tree-ssa-propagate.c b/gcc/tree-ssa-propagate.c index 270c1cb..97da116 100644 --- a/gcc/tree-ssa-propagate.c +++ b/gcc/tree-ssa-propagate.c @@ -902,12 +902,6 @@ substitute_and_fold_engine::replace_phi_args_in (gphi *phi) size_t i; bool replaced = false; - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, "Folding PHI node: "); - print_gimple_stmt (dump_file, phi, 0, TDF_SLIM); - } - for (i = 0; i < gimple_phi_num_args (phi); i++) { tree arg = gimple_phi_arg_def (phi, i); @@ -1054,6 +1048,11 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb) tree res = gimple_phi_result (phi); if (virtual_operand_p (res)) continue; + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "Folding PHI node: "); + print_gimple_stmt (dump_file, phi, 0, TDF_SLIM); + } if (res && TREE_CODE (res) == SSA_NAME) { tree sprime = substitute_and_fold_engine->get_value (res, phi); @@ -1061,6 +1060,12 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb) && sprime != res && may_propagate_copy (res, sprime)) { + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "Queued PHI for removal. Folds to: "); + print_generic_expr (dump_file, sprime); + fprintf (dump_file, "\n"); + } stmts_to_remove.safe_push (phi); continue; } @@ -1079,6 +1084,12 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb) substitute_and_fold_engine->pre_fold_stmt (stmt); + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "Folding statement: "); + print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); + } + /* No point propagating into a stmt we have a value for we can propagate into all uses. Mark it for removal instead. */ tree lhs = gimple_get_lhs (stmt); @@ -1094,6 +1105,12 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb) && (!is_gimple_assign (stmt) || gimple_assign_rhs_code (stmt) != ASSERT_EXPR)) { + if (dump_file && (dump_flags & TDF_DETAILS)) + { + fprintf (dump_file, "Queued stmt for removal. Folds to: "); + print_generic_expr (dump_file, sprime); + fprintf (dump_file, "\n"); + } stmts_to_remove.safe_push (stmt); continue; } @@ -1102,12 +1119,6 @@ substitute_and_fold_dom_walker::before_dom_children (basic_block bb) /* Replace the statement with its folded version and mark it folded. */ did_replace = false; - if (dump_file && (dump_flags & TDF_DETAILS)) - { - fprintf (dump_file, "Folding statement: "); - print_gimple_stmt (dump_file, stmt, 0, TDF_SLIM); - } - gimple *old_stmt = stmt; bool was_noreturn = (is_gimple_call (stmt) && gimple_call_noreturn_p (stmt)); diff --git a/gcc/vr-values.c b/gcc/vr-values.c index 8913da4..18a4134 100644 --- a/gcc/vr-values.c +++ b/gcc/vr-values.c @@ -2556,20 +2556,26 @@ simplify_using_ranges::vrp_visit_cond_stmt (gcond *stmt, edge *taken_edge_p) { tree use; ssa_op_iter i; + bool first = true; fprintf (dump_file, "\nVisiting conditional with predicate: "); print_gimple_stmt (dump_file, stmt, 0); - fprintf (dump_file, "\nWith known ranges\n"); FOR_EACH_SSA_TREE_OPERAND (use, stmt, i, SSA_OP_USE) { + if (first) + { + fprintf (dump_file, "With known ranges\n"); + first = false; + } fprintf (dump_file, "\t"); print_generic_expr (dump_file, use); fprintf (dump_file, ": "); dump_value_range (dump_file, get_value_range_equiv (use, stmt)); } - fprintf (dump_file, "\n"); + if (!first) + fprintf (dump_file, "\n"); } /* Compute the value of the predicate COND by checking the known |