From 880456ed99d23ae76be4ecc929bcbcf8cae5eb66 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 12 Apr 2022 15:06:40 +0200 Subject: [PATCH] Remove loop-incremented dead code. gcc/ChangeLog: * genautomata.cc (create_composed_state): Remove dead code. * graphite-poly.cc (print_pdrs): Likewise. * lto-wrapper.cc (run_gcc): Likewise. * tree-switch-conversion.cc (switch_decision_tree::balance_case_nodes): Likewise. --- gcc/genautomata.cc | 21 +++++++++------------ gcc/graphite-poly.cc | 10 ---------- gcc/lto-wrapper.cc | 7 +------ gcc/tree-switch-conversion.cc | 10 +++------- 4 files changed, 13 insertions(+), 35 deletions(-) diff --git a/gcc/genautomata.cc b/gcc/genautomata.cc index e43314e4ea3..389c1c3e0ed 100644 --- a/gcc/genautomata.cc +++ b/gcc/genautomata.cc @@ -5661,7 +5661,6 @@ create_composed_state (state_t original_state, arc_t arcs_marked_by_insn, state_t state_in_table; state_t temp_state; alt_state_t canonical_alt_states_list; - int alts_number; int new_state_p = 0; if (arcs_marked_by_insn == NULL) @@ -5731,17 +5730,15 @@ create_composed_state (state_t original_state, arc_t arcs_marked_by_insn, || (curr_arc->insn->insn_reserv_decl != DECL_INSN_RESERV (advance_cycle_insn_decl))) add_arc (state, curr_arc->to_state, curr_arc->insn); - } - arcs_marked_by_insn->to_state = state; - for (alts_number = 0, - curr_arc = arcs_marked_by_insn->next_arc_marked_by_insn; - curr_arc != NULL; - curr_arc = next_arc) - { - next_arc = curr_arc->next_arc_marked_by_insn; - remove_arc (original_state, curr_arc); - alts_number++; - } + } + arcs_marked_by_insn->to_state = state; + for (curr_arc = arcs_marked_by_insn->next_arc_marked_by_insn; + curr_arc != NULL; + curr_arc = next_arc) + { + next_arc = curr_arc->next_arc_marked_by_insn; + remove_arc (original_state, curr_arc); + } } } if (!state->it_was_placed_in_stack_for_DFA_forming) diff --git a/gcc/graphite-poly.cc b/gcc/graphite-poly.cc index 42ed038768e..173aae07442 100644 --- a/gcc/graphite-poly.cc +++ b/gcc/graphite-poly.cc @@ -341,20 +341,10 @@ dump_gbb_conditions (FILE *file, gimple_poly_bb_p gbb) void print_pdrs (FILE *file, poly_bb_p pbb) { - int nb_reads = 0; - int nb_writes = 0; - if (PBB_DRS (pbb).is_empty ()) return; fprintf (file, "Data references (\n"); - - for (poly_dr_p pdr : PBB_DRS (pbb)) - if (PDR_TYPE (pdr) == PDR_READ) - nb_reads++; - else - nb_writes++; - fprintf (file, "Read data references (\n"); for (poly_dr_p pdr : PBB_DRS (pbb)) diff --git a/gcc/lto-wrapper.cc b/gcc/lto-wrapper.cc index 285e6e96af5..26e06e77be4 100644 --- a/gcc/lto-wrapper.cc +++ b/gcc/lto-wrapper.cc @@ -1428,7 +1428,6 @@ run_gcc (unsigned argc, char *argv[]) char **lto_argv, **ltoobj_argv; bool linker_output_rel = false; bool skip_debug = false; - unsigned n_debugobj; const char *incoming_dumppfx = dumppfx = NULL; static char current_dir[] = { '.', DIR_SEPARATOR, '\0' }; @@ -1871,7 +1870,6 @@ cont1: /* Copy the early generated debug info from the objects to temporary files and append those to the partial link commandline. */ - n_debugobj = 0; early_debug_object_names = NULL; if (! skip_debug) { @@ -1881,10 +1879,7 @@ cont1: { const char *tem; if ((tem = debug_objcopy (ltoobj_argv[i], !linker_output_rel))) - { - early_debug_object_names[i] = tem; - n_debugobj++; - } + early_debug_object_names[i] = tem; } } diff --git a/gcc/tree-switch-conversion.cc b/gcc/tree-switch-conversion.cc index e14b4e6c94a..50a17927f39 100644 --- a/gcc/tree-switch-conversion.cc +++ b/gcc/tree-switch-conversion.cc @@ -2039,18 +2039,14 @@ switch_decision_tree::balance_case_nodes (case_tree_node **head, if (np) { int i = 0; - int ranges = 0; case_tree_node **npp; case_tree_node *left; profile_probability prob = profile_probability::never (); - /* Count the number of entries on branch. Also count the ranges. */ + /* Count the number of entries on branch. */ while (np) { - if (!tree_int_cst_equal (np->m_c->get_low (), np->m_c->get_high ())) - ranges++; - i++; prob += np->m_c->m_prob; np = np->m_right; @@ -2063,8 +2059,8 @@ switch_decision_tree::balance_case_nodes (case_tree_node **head, left = *npp; profile_probability pivot_prob = prob.apply_scale (1, 2); - /* Find the place in the list that bisects the list's total cost, - where ranges count as 2. */ + /* Find the place in the list that bisects the list's total cost + by probability. */ while (1) { /* Skip nodes while their probability does not reach