static void update_phis_for_loop_copy (struct loop *orig_loop, struct loop *new_loop) { tree new_ssa_name; gimple_stmt_iterator si_new, si_orig; edge orig_loop_latch = loop_latch_edge (orig_loop); edge orig_entry_e = loop_preheader_edge (orig_loop); edge new_loop_entry_e = loop_preheader_edge (new_loop); /* Scan the phis in the headers of the old and new loops (they are organized in exactly the same order). */ for (si_new = gsi_start_phis (new_loop->header), si_orig = gsi_start_phis (orig_loop->header); !gsi_end_p (si_new) && !gsi_end_p (si_orig); gsi_next (&si_new), gsi_next (&si_orig)) { tree def; source_location locus; gimple phi_new = gsi_stmt (si_new); gimple phi_orig = gsi_stmt (si_orig); /* Add the first phi argument for the phi in NEW_LOOP (the one associated with the entry of NEW_LOOP) */ def = PHI_ARG_DEF_FROM_EDGE (phi_orig, orig_entry_e); locus = gimple_phi_arg_location_from_edge (phi_orig, orig_entry_e); add_phi_arg (phi_new, def, new_loop_entry_e, locus); /* Add the second phi argument for the phi in NEW_LOOP (the one associated with the latch of NEW_LOOP) */ def = PHI_ARG_DEF_FROM_EDGE (phi_orig, orig_loop_latch); locus = gimple_phi_arg_location_from_edge (phi_orig, orig_loop_latch); if (TREE_CODE (def) == SSA_NAME) { new_ssa_name = get_current_def (def); if (!new_ssa_name) /* This only happens if there are no definitions inside the loop. Use the phi_result in this case. */ new_ssa_name = PHI_RESULT (phi_new); } else /* Could be an integer. */ new_ssa_name = def; add_phi_arg (phi_new, new_ssa_name, loop_latch_edge (new_loop), locus); } }
static void eliminate_build (elim_graph g) { tree Ti; int p0, pi; gimple_stmt_iterator gsi; clear_elim_graph (g); for (gsi = gsi_start_phis (g->e->dest); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple phi = gsi_stmt (gsi); source_location locus; p0 = var_to_partition (g->map, gimple_phi_result (phi)); /* Ignore results which are not in partitions. */ if (p0 == NO_PARTITION) continue; Ti = PHI_ARG_DEF (phi, g->e->dest_idx); locus = gimple_phi_arg_location_from_edge (phi, g->e); /* If this argument is a constant, or a SSA_NAME which is being left in SSA form, just queue a copy to be emitted on this edge. */ if (!phi_ssa_name_p (Ti) || (TREE_CODE (Ti) == SSA_NAME && var_to_partition (g->map, Ti) == NO_PARTITION)) { /* Save constant copies until all other copies have been emitted on this edge. */ VEC_safe_push (int, heap, g->const_dests, p0); VEC_safe_push (tree, heap, g->const_copies, Ti); VEC_safe_push (source_location, heap, g->copy_locus, locus); } else {