+2012-07-10 Dehao Chen <dehao@google.com>
+
+ * tree.h (phi_arg_d): New field.
+ * tree-flow-inline.h (gimple_phi_arg_block): New function.
+ (gimple_phi_arg_block_from_edge): New function.
+ (gimple_phi_arg_set_block): New function.
+ (gimple_phi_arg_has_block): New function.
+ (redirect_edge_var_map_block): New function.
+ * tree-flow.h (_edge_var_map): New field.
+ * tree-ssa-live.c (remove_unused_locals): Mark phi_arg's block
+ as used.
+ * tree-eh.c (cleanup_empty_eh_merge_phis): Add block debug info for
+ redirect_edge_var_map_add.
+ * tree-outof-ssa.c (_elim_graph): New field.
+ (insert_partition_copy_on_edge): New parameter.
+ (insert_value_copy_on_edge): New parameter.
+ (insert_rtx_to_part_on_edge): New parameter.
+ (insert_part_to_rtx_on_edge): New parameter.
+ (elim_graph_add_edge): New parameter.
+ (elim_graph_remove_succ_edge): New parameter.
+ (FOR_EACH_ELIM_GRAPH_SUCC): New parameter.
+ (FOR_EACH_ELIM_GRAPH_PRED): New parameter.
+ (new_elim_graph): Add block debug info.
+ (clear_elim_graph): Likewise.
+ (delete_elim_graph): Likewise.
+ (elim_graph_add_node): Likewise.
+ (elim_graph_add_edge): Likewise.
+ (elim_graph_remove_succ_edge): Likewise.
+ (eliminate_build): Likewise.
+ (elim_forward): Likewise.
+ (elim_unvisited_predecessor): Likewise.
+ (elim_backward): Likewise.
+ (elim_create): Likewise.
+ (eliminate_phi): Likewise.
+ (insert_backedge_copies): Likewise.
+ * tree-into-ssa.c (insert_phi_nodes_for): Add block debug info for
+ add_phi_arg.
+ (rewrite_add_phi_arguments): Likewise.
+ * tree-ssa-loop-im.c (execute_sm_if_changed): Likewise.
+ * tree-ssa-tail-merge.c (replace_block_by): Likewise.
+ * tree-ssa-threadupdate.c (copy_phi_args): Likewise.
+ * tree-loop-distribution.c (update_phis_for_loop_copy): Likewise.
+ * tree-ssa-loop-manip.c (create_iv): Likewise.
+ (add_exit_phis_edge): Likewise.
+ (split_loop_exit_edge): Likewise.
+ (copy_phi_node_args): Likewise.
+ (tree_transform_and_unroll_loop): Likewise.
+ * value-prof.c (gimple_ic): Likewise.
+ (gimple_stringop_fixed_value): Likewise.
+ * tree-tailcall.c (add_successor_phi_arg): Likewise.
+ (eliminate_tail_call): Likewise.
+ (create_tailcall_accumulator): Likewise.
+ (tree_optimize_tail_calls_1): Likewise.
+ * tree-phinodes.c (add_phi_arg): Likewise.
+ (make_phi_node): Likewise.
+ (resize_phi_node): Likewise.
+ (remove_phi_arg_num): Likewise.
+ * omp-low.c (expand_parallel_call): Likewise.
+ (expand_omp_for_static_chunk): Likewise.
+ * tree-vect-loop-manip.c (slpeel_update_phis_for_duplicate_loop):
+ Likewise.
+ (slpeel_update_phi_nodes_for_guard1): Likewise.
+ (slpeel_update_phi_nodes_for_guard2): Likewise.
+ (slpeel_tree_duplicate_loop_to_edge_cfg): Likewise.
+ (set_prologue_iterations): Likewise.
+ (slpeel_tree_peel_loop_to_edge): Likewise.
+ (vect_loop_versioning): Likewise.
+ * tree-parloops.c (create_phi_for_local_result): Likewise.
+ (transform_to_exit_first_loop): Likewise.
+ (create_parallel_loop): Likewise.
+ * ipa-split.c (split_function): Likewise.
+ * tree-vect-loop.c (get_initial_def_for_induction): Likewise.
+ (vect_create_epilog_for_reduction): Likewise.
+ * tree-vect-data-refs.c (vect_setup_realignment): Likewise.
+ * graphite-scop-detection.c (canonicalize_loop_closed_ssa): Likewise.
+ * tree-ssa-phiopt.c (cond_store_replacement): Likewise.
+ (cond_if_else_store_replacement_1): Likewise.
+ * tree-cfgcleanup.c (remove_forwarder_block): Likewise.
+ (remove_forwarder_block_with_phi): Likewise.
+ * tree-ssa-pre.c (insert_into_preds_of_block): Likewise.
+ * tree-predcom.c (initialize_root_vars): Likewise.
+ (initialize_root_vars_lm): Likewise.
+ * sese.c (sese_add_exit_phis_edge): Likewise.
+ * tree-ssa-dce.c (forward_edge_to_pdom): Likewise.
+ * tree-ssa.c (flush_pending_stmts): Likewise.
+ (redirect_edge_var_map_add): Likewise.
+ (ssa_redirect_edge): Likewise.
+ * gimple-streamer-in.c (input_phi): Likewise.
+ * tree-vect-stmts.c (vectorizable_load): Likewise.
+ * tree-inline.c (copy_phis_for_bb): Likewise.
+ * tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
+ * tree-switch-conversion.c (fix_phi_nodes): Likewise.
+ * tree-cfg.c (reinstall_phi_args): Likewise.
+ (gimple_make_forwarder_block): Likewise.
+ (add_phi_args_after_copy_edge): Likewise.
+ (gimple_duplicate_sese_tail): Likewise.
+
2012-07-09 Oleg Endo <olegendo@gcc.gnu.org>
PR target/53886
break;
}
- add_phi_arg (result, def, e, arg_loc);
+ add_phi_arg (result, def, e, arg_loc, NULL);
}
return result;
gimple_phi_result_ptr (close_phi));
add_phi_arg (close_phi, arg,
gimple_phi_arg_edge (close_phi, 0),
- UNKNOWN_LOCATION);
+ UNKNOWN_LOCATION, NULL);
use_p = gimple_phi_arg_imm_use_ptr (phi, i);
replace_exp (use_p, res);
update_stmt (phi);
/* When there is PHI, just update its value. */
if (TREE_CODE (retval) == SSA_NAME
&& !gsi_end_p (psi))
- add_phi_arg (gsi_stmt (psi), retval, e, UNKNOWN_LOCATION);
+ add_phi_arg (gsi_stmt (psi), retval, e, UNKNOWN_LOCATION,
+ NULL);
/* Otherwise update the return BB itself.
find_return_bb allows at most one assignment to return value,
so update first statement. */
{
gimple phi = create_phi_node (tmp_join, bb);
SSA_NAME_DEF_STMT (tmp_join) = phi;
- add_phi_arg (phi, tmp_then, e_then, UNKNOWN_LOCATION);
- add_phi_arg (phi, tmp_else, e_else, UNKNOWN_LOCATION);
+ add_phi_arg (phi, tmp_then, e_then, UNKNOWN_LOCATION, NULL);
+ add_phi_arg (phi, tmp_else, e_else, UNKNOWN_LOCATION, NULL);
}
val = tmp_join;
{
gimple nphi;
source_location locus;
+ tree block;
phi = gsi_stmt (psi);
t = gimple_phi_result (phi);
t = PHI_ARG_DEF_FROM_EDGE (phi, se);
locus = gimple_phi_arg_location_from_edge (phi, se);
+ block = gimple_phi_arg_block_from_edge (phi, se);
/* A special case -- fd->loop.v is not yet computed in
iter_part_bb, we need to use v_extra instead. */
if (t == fd->loop.v)
t = v_extra;
- add_phi_arg (nphi, t, ene, locus);
+ add_phi_arg (nphi, t, ene, locus, block);
locus = redirect_edge_var_map_location (vm);
- add_phi_arg (nphi, redirect_edge_var_map_def (vm), re, locus);
+ block = redirect_edge_var_map_block (vm);
+ add_phi_arg (nphi, redirect_edge_var_map_def (vm), re, locus, block);
}
gcc_assert (!gsi_end_p (psi) && i == VEC_length (edge_var_map, head));
redirect_edge_var_map_clear (re);
phi = create_phi_node (trip_main, iter_part_bb);
SSA_NAME_DEF_STMT (trip_main) = phi;
add_phi_arg (phi, trip_back, single_succ_edge (trip_update_bb),
- UNKNOWN_LOCATION);
+ UNKNOWN_LOCATION, NULL);
add_phi_arg (phi, trip_init, single_succ_edge (entry_bb),
- UNKNOWN_LOCATION);
+ UNKNOWN_LOCATION, NULL);
}
set_immediate_dominator (CDI_DOMINATORS, trip_update_bb, cont_bb);
create_new_def_for (gimple_phi_result (phi), phi,
gimple_phi_result_ptr (phi));
- add_phi_arg (phi, use, false_e, UNKNOWN_LOCATION);
- add_phi_arg (phi, use, true_e, UNKNOWN_LOCATION);
+ add_phi_arg (phi, use, false_e, UNKNOWN_LOCATION, NULL);
+ add_phi_arg (phi, use, true_e, UNKNOWN_LOCATION, NULL);
}
/* Insert in the block BB phi nodes for variables defined in REGION
+2012-07-10 Dehao Chen <dehao@google.com>
+
+ * gcc.dg/debug_info_inline.c: New test.
+
2012-07-10 Jason Merrill <jason@redhat.com>
PR c++/53733
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -g" } */
+
+int g, a;
+
+static int foo ()
+{
+ int ret = a;
+
+ if (g > -10)
+ return 10;
+
+ return ret;
+}
+
+int bar()
+{
+ if (foo())
+ return 0;
+ else
+ return 1;
+}
+
+/* { dg-final { scan-assembler "loc 1 19 0\n.*\n.LBB" } } */
gcc_assert (result == gimple_phi_result (phi));
- add_phi_arg (phi, arg, new_edge, redirect_edge_var_map_location (vm));
+ add_phi_arg (phi, arg, new_edge, redirect_edge_var_map_location (vm),
+ redirect_edge_var_map_block (vm));
}
redirect_edge_var_map_clear (old_edge);
SSA_NAME_DEF_STMT (var) = new_phi;
gimple_phi_set_result (phi, make_ssa_name (SSA_NAME_VAR (var), phi));
add_phi_arg (new_phi, gimple_phi_result (phi), fallthru,
- UNKNOWN_LOCATION);
+ UNKNOWN_LOCATION, NULL);
}
/* Add the arguments we have stored on edges. */
phi_copy = gsi_stmt (psi_copy);
def = PHI_ARG_DEF_FROM_EDGE (phi, e);
add_phi_arg (phi_copy, def, e_copy,
- gimple_phi_arg_location_from_edge (phi, e));
+ gimple_phi_arg_location_from_edge (phi, e),
+ gimple_phi_arg_block_from_edge (phi, e));
}
}
{
phi = gsi_stmt (psi);
def = PHI_ARG_DEF (phi, nexits[0]->dest_idx);
- add_phi_arg (phi, def, e, gimple_phi_arg_location_from_edge (phi, e));
+ add_phi_arg (phi, def, e, gimple_phi_arg_location_from_edge (phi, e),
+ gimple_phi_arg_block_from_edge (phi, e));
}
}
e = redirect_edge_and_branch (nexits[1], nexits[0]->dest);
phi1 = gsi_stmt (psi1);
phi2 = gsi_stmt (psi2);
def = PHI_ARG_DEF (phi2, e2->dest_idx);
- add_phi_arg (phi1, def, e, gimple_phi_arg_location_from_edge (phi2, e2));
+ add_phi_arg (phi1, def, e, gimple_phi_arg_location_from_edge (phi2, e2),
+ gimple_phi_arg_block_from_edge (phi2, e2));
}
}
{
gimple phi = gsi_stmt (gsi);
source_location l = gimple_phi_arg_location_from_edge (phi, succ);
- add_phi_arg (phi, gimple_phi_arg_def (phi, succ->dest_idx), s, l);
+ tree b = gimple_phi_arg_block_from_edge (phi, succ);
+ add_phi_arg (phi, gimple_phi_arg_def (phi, succ->dest_idx), s, l,
+ b);
}
}
}
gimple phi = gsi_stmt (gsi);
tree def = gimple_phi_arg_def (phi, succ->dest_idx);
source_location locus = gimple_phi_arg_location_from_edge (phi, succ);
+ tree block = gimple_phi_arg_block_from_edge (phi, succ);
if (TREE_CODE (def) == SSA_NAME)
{
{
def = new_arg;
locus = redirect_edge_var_map_location (vm);
+ block = redirect_edge_var_map_block (vm);
break;
}
}
}
- add_phi_arg (phi, def, s, locus);
+ add_phi_arg (phi, def, s, locus, block);
}
redirect_edge_var_map_clear (e);
FOR_EACH_EDGE (e, ei, old_bb->preds)
{
location_t oloc;
+ tree oblock;
tree oop;
if ((e->flags & EDGE_EH) == 0)
continue;
oop = gimple_phi_arg_def (ophi, e->dest_idx);
oloc = gimple_phi_arg_location (ophi, e->dest_idx);
- redirect_edge_var_map_add (e, nresult, oop, oloc);
+ oblock = gimple_phi_arg_block (ophi, e->dest_idx);
+ redirect_edge_var_map_add (e, nresult, oop, oloc, oblock);
}
}
/* If we didn't find the PHI, but it's a VOP, remember to rename
{
location_t nloc
= gimple_phi_arg_location (nphi, old_bb_out->dest_idx);
+ tree nblock = gimple_phi_arg_block (nphi, old_bb_out->dest_idx);
FOR_EACH_EDGE (e, ei, old_bb->preds)
- redirect_edge_var_map_add (e, nresult, nop, nloc);
+ redirect_edge_var_map_add (e, nresult, nop, nloc, nblock);
}
}
return gimple_phi_arg (gs, e->dest_idx)->locus;
}
+/* Return the block location of gimple argument I of phi node GS. */
+
+static inline tree
+gimple_phi_arg_block (gimple gs, size_t i)
+{
+ return gimple_phi_arg (gs, i)->block;
+}
+
+/* Return the block location of the argument on edge E of phi node GS. */
+
+static inline tree
+gimple_phi_arg_block_from_edge (gimple gs, edge e)
+{
+ return gimple_phi_arg (gs, e->dest_idx)->block;
+}
+
/* Set the source location of gimple argument I of phi node GS to LOC. */
static inline void
gimple_phi_arg (gs, i)->locus = loc;
}
+/* Set the block location of gimple argument I of phi node GS to BLOCK. */
+
+static inline void
+gimple_phi_arg_set_block (gimple gs, size_t i, tree block)
+{
+ gimple_phi_arg (gs, i)->block = block;
+}
+
/* Return TRUE if argument I of phi node GS has a location record. */
static inline bool
return gimple_phi_arg_location (gs, i) != UNKNOWN_LOCATION;
}
+/* Return TRUE if argument I of phi node GS has a location record. */
+
+static inline bool
+gimple_phi_arg_has_block (gimple gs, size_t i)
+{
+ return gimple_phi_arg_block (gs, i) != NULL;
+}
/* Return the PHI nodes for basic block BB, or NULL if there are no
PHI nodes. */
return v->locus;
}
+/* Given an edge_var_map V, return the PHI arg location. */
+
+static inline tree
+redirect_edge_var_map_block (edge_var_map *v)
+{
+ return v->block;
+}
/* Return an SSA_NAME node for variable VAR defined in statement STMT
in function cfun. */
extern void reserve_phi_args_for_new_edge (basic_block);
extern void add_phi_node_to_bb (gimple phi, basic_block bb);
extern gimple create_phi_node (tree, basic_block);
-extern void add_phi_arg (gimple, tree, edge, source_location);
+extern void add_phi_arg (gimple, tree, edge, source_location, tree);
extern void remove_phi_args (edge);
extern void remove_phi_node (gimple_stmt_iterator *, bool);
extern void remove_phi_nodes (basic_block);
tree result; /* PHI result. */
tree def; /* PHI arg definition. */
source_location locus; /* PHI arg location. */
+ tree block; /* PHI arg block. */
};
typedef struct _edge_var_map edge_var_map;
typedef VEC(edge_var_map, heap) *edge_var_map_vector;
extern void init_tree_ssa (struct function *);
-extern void redirect_edge_var_map_add (edge, tree, tree, source_location);
+extern void redirect_edge_var_map_add (edge, tree, tree, source_location, tree);
extern void redirect_edge_var_map_clear (edge);
extern void redirect_edge_var_map_dup (edge, edge);
extern edge_var_map_vector redirect_edge_var_map_vector (edge);
tree arg;
tree new_arg;
tree block = id->block;
+ tree arg_block, *n;
edge_iterator ei2;
/* When doing partial cloning, we allow PHIs on the entry block
gsi_insert_seq_on_edge (new_edge, stmts);
inserted = true;
}
+ n = (tree *) pointer_map_contains (id->decl_map,
+ gimple_phi_arg_block_from_edge (phi, old_edge));
+ if (n)
+ arg_block = *n;
+ else
+ arg_block = NULL;
add_phi_arg (new_phi, new_arg, new_edge,
- gimple_phi_arg_location_from_edge (phi, old_edge));
+ gimple_phi_arg_location_from_edge (phi, old_edge),
+ arg_block);
}
}
}
renamer will use the symbol on the LHS to get its
reaching definition. */
FOR_EACH_EDGE (e, ei, bb->preds)
- add_phi_arg (phi, var, e, UNKNOWN_LOCATION);
+ add_phi_arg (phi, var, e, UNKNOWN_LOCATION, NULL);
}
else
{
phi = gsi_stmt (gsi);
currdef = get_reaching_def (SSA_NAME_VAR (gimple_phi_result (phi)));
stmt = SSA_NAME_DEF_STMT (currdef);
- add_phi_arg (phi, currdef, e, gimple_location (stmt));
+ add_phi_arg (phi, currdef, e, gimple_location (stmt),
+ gimple_block (stmt));
}
}
}
{
tree def;
source_location locus;
+ tree block;
gimple phi_new = gsi_stmt (si_new);
gimple phi_orig = gsi_stmt (si_orig);
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);
+ block = gimple_phi_arg_block_from_edge (phi_orig, orig_entry_e);
+ add_phi_arg (phi_new, def, new_loop_entry_e, locus, block);
/* 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);
+ block = gimple_phi_arg_block_from_edge (phi_orig, orig_loop_latch);
if (TREE_CODE (def) == SSA_NAME)
{
/* Could be an integer. */
new_ssa_name = def;
- add_phi_arg (phi_new, new_ssa_name, loop_latch_edge (new_loop), locus);
+ add_phi_arg (phi_new, new_ssa_name, loop_latch_edge (new_loop), locus,
+ block);
}
}
/* Source locus on each edge */
VEC(source_location,heap) *edge_locus;
+ /* Block location on each edge. */
+ VEC(tree,heap) *edge_block;
+
/* Visited vector. */
sbitmap visited;
/* Source locations for any constant copies. */
VEC(source_location,heap) *copy_locus;
+
+ /* Block locations for any constant copies. */
+ VEC(tree,heap) *copy_block;
} *elim_graph;
/* Insert a copy instruction from partition SRC to DEST onto edge E. */
static void
-insert_partition_copy_on_edge (edge e, int dest, int src, source_location locus)
+insert_partition_copy_on_edge (edge e, int dest, int src, source_location locus,
+ tree block)
{
tree var;
rtx seq;
set_location_for_edge (e);
/* If a locus is provided, override the default. */
if (locus)
- set_curr_insn_source_location (locus);
+ {
+ set_curr_insn_source_location (locus);
+ set_curr_insn_block (block);
+ }
var = partition_to_var (SA.map, src);
seq = emit_partition_copy (SA.partition_to_pseudo[dest],
onto edge E. */
static void
-insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus)
+insert_value_copy_on_edge (edge e, int dest, tree src, source_location locus,
+ tree block)
{
rtx seq, x;
enum machine_mode dest_mode, src_mode;
set_location_for_edge (e);
/* If a locus is provided, override the default. */
if (locus)
- set_curr_insn_source_location (locus);
+ {
+ set_curr_insn_source_location (locus);
+ set_curr_insn_block (block);
+ }
start_sequence ();
static void
insert_rtx_to_part_on_edge (edge e, int dest, rtx src, int unsignedsrcp,
- source_location locus)
+ source_location locus, tree block)
{
rtx seq;
if (dump_file && (dump_flags & TDF_DETAILS))
set_location_for_edge (e);
/* If a locus is provided, override the default. */
if (locus)
- set_curr_insn_source_location (locus);
+ {
+ set_curr_insn_source_location (locus);
+ set_curr_insn_block (block);
+ }
/* We give the destination as sizeexp in case src/dest are BLKmode
mems. Usually we give the source. As we result from SSA names
onto edge E. */
static void
-insert_part_to_rtx_on_edge (edge e, rtx dest, int src, source_location locus)
+insert_part_to_rtx_on_edge (edge e, rtx dest, int src, source_location locus,
+ tree block)
{
tree var;
rtx seq;
set_location_for_edge (e);
/* If a locus is provided, override the default. */
if (locus)
- set_curr_insn_source_location (locus);
+ {
+ set_curr_insn_source_location (locus);
+ set_curr_insn_block (block);
+ }
var = partition_to_var (SA.map, src);
seq = emit_partition_copy (dest,
g->const_dests = VEC_alloc (int, heap, 20);
g->const_copies = VEC_alloc (tree, heap, 20);
g->copy_locus = VEC_alloc (source_location, heap, 10);
+ g->copy_block = VEC_alloc (tree, heap, 10);
g->edge_list = VEC_alloc (int, heap, 20);
g->edge_locus = VEC_alloc (source_location, heap, 10);
+ g->edge_block = VEC_alloc (tree, heap, 10);
g->stack = VEC_alloc (int, heap, 30);
g->visited = sbitmap_alloc (size);
VEC_truncate (int, g->nodes, 0);
VEC_truncate (int, g->edge_list, 0);
VEC_truncate (source_location, g->edge_locus, 0);
+ VEC_truncate (tree, g->edge_block, 0);
}
VEC_free (int, heap, g->const_dests);
VEC_free (int, heap, g->nodes);
VEC_free (source_location, heap, g->copy_locus);
+ VEC_free (tree, heap, g->copy_block);
VEC_free (source_location, heap, g->edge_locus);
+ VEC_free (tree, heap, g->edge_block);
free (g);
}
/* Add the edge PRED->SUCC to graph G. */
static inline void
-elim_graph_add_edge (elim_graph g, int pred, int succ, source_location locus)
+elim_graph_add_edge (elim_graph g, int pred, int succ, source_location locus,
+ tree block)
{
VEC_safe_push (int, heap, g->edge_list, pred);
VEC_safe_push (int, heap, g->edge_list, succ);
VEC_safe_push (source_location, heap, g->edge_locus, locus);
+ VEC_safe_push (tree, heap, g->edge_block, block);
}
return the successor node. -1 is returned if there is no such edge. */
static inline int
-elim_graph_remove_succ_edge (elim_graph g, int node, source_location *locus)
+elim_graph_remove_succ_edge (elim_graph g, int node, source_location *locus,
+ tree *block)
{
int y;
unsigned x;
VEC_replace (int, g->edge_list, x + 1, -1);
*locus = VEC_index (source_location, g->edge_locus, x / 2);
VEC_replace (source_location, g->edge_locus, x / 2, UNKNOWN_LOCATION);
+ *block = VEC_index (tree, g->edge_block, x / 2);
+ VEC_replace (tree, g->edge_block, x / 2, NULL);
return y;
}
*locus = UNKNOWN_LOCATION;
+ *block = NULL;
return -1;
}
edge list. VAR will hold the partition number found. CODE is the
code fragment executed for every node found. */
-#define FOR_EACH_ELIM_GRAPH_SUCC(GRAPH, NODE, VAR, LOCUS, CODE) \
+#define FOR_EACH_ELIM_GRAPH_SUCC(GRAPH, NODE, VAR, LOCUS, BLOCK, CODE) \
do { \
unsigned x_; \
int y_; \
(void) ((VAR) = VEC_index (int, (GRAPH)->edge_list, x_ + 1)); \
(void) ((LOCUS) = VEC_index (source_location, \
(GRAPH)->edge_locus, x_ / 2)); \
+ (void) ((BLOCK) = VEC_index (tree, \
+ (GRAPH)->edge_block, x_ / 2)); \
CODE; \
} \
} while (0)
GRAPH. VAR will hold the partition number found. CODE is the
code fragment executed for every node found. */
-#define FOR_EACH_ELIM_GRAPH_PRED(GRAPH, NODE, VAR, LOCUS, CODE) \
+#define FOR_EACH_ELIM_GRAPH_PRED(GRAPH, NODE, VAR, LOCUS, BLOCK, CODE) \
do { \
unsigned x_; \
int y_; \
(void) ((VAR) = VEC_index (int, (GRAPH)->edge_list, x_)); \
(void) ((LOCUS) = VEC_index (source_location, \
(GRAPH)->edge_locus, x_ / 2)); \
+ (void) ((BLOCK) = VEC_index (tree, \
+ (GRAPH)->edge_block, x_ / 2)); \
CODE; \
} \
} while (0)
{
gimple phi = gsi_stmt (gsi);
source_location locus;
+ tree block;
p0 = var_to_partition (g->map, gimple_phi_result (phi));
/* Ignore results which are not in partitions. */
Ti = PHI_ARG_DEF (phi, g->e->dest_idx);
locus = gimple_phi_arg_location_from_edge (phi, g->e);
+ block = gimple_phi_arg_block_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
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);
+ VEC_safe_push (tree, heap, g->copy_block, block);
}
else
{
{
eliminate_name (g, p0);
eliminate_name (g, pi);
- elim_graph_add_edge (g, p0, pi, locus);
+ elim_graph_add_edge (g, p0, pi, locus, block);
}
}
}
{
int S;
source_location locus;
+ tree block;
SET_BIT (g->visited, T);
- FOR_EACH_ELIM_GRAPH_SUCC (g, T, S, locus,
+ FOR_EACH_ELIM_GRAPH_SUCC (g, T, S, locus, block,
{
if (!TEST_BIT (g->visited, S))
elim_forward (g, S);
{
int P;
source_location locus;
+ tree block;
- FOR_EACH_ELIM_GRAPH_PRED (g, T, P, locus,
+ FOR_EACH_ELIM_GRAPH_PRED (g, T, P, locus, block,
{
if (!TEST_BIT (g->visited, P))
return 1;
{
int P;
source_location locus;
+ tree block;
SET_BIT (g->visited, T);
- FOR_EACH_ELIM_GRAPH_PRED (g, T, P, locus,
+ FOR_EACH_ELIM_GRAPH_PRED (g, T, P, locus, block,
{
if (!TEST_BIT (g->visited, P))
{
elim_backward (g, P);
- insert_partition_copy_on_edge (g->e, P, T, locus);
+ insert_partition_copy_on_edge (g->e, P, T, locus, block);
}
});
}
{
int P, S;
source_location locus;
+ tree block;
if (elim_unvisited_predecessor (g, T))
{
rtx U = get_temp_reg (var);
int unsignedsrcp = TYPE_UNSIGNED (TREE_TYPE (var));
- insert_part_to_rtx_on_edge (g->e, U, T, UNKNOWN_LOCATION);
- FOR_EACH_ELIM_GRAPH_PRED (g, T, P, locus,
+ insert_part_to_rtx_on_edge (g->e, U, T, UNKNOWN_LOCATION, NULL);
+ FOR_EACH_ELIM_GRAPH_PRED (g, T, P, locus, block,
{
if (!TEST_BIT (g->visited, P))
{
elim_backward (g, P);
- insert_rtx_to_part_on_edge (g->e, P, U, unsignedsrcp, locus);
+ insert_rtx_to_part_on_edge (g->e, P, U, unsignedsrcp, locus,
+ block);
}
});
}
else
{
- S = elim_graph_remove_succ_edge (g, T, &locus);
+ S = elim_graph_remove_succ_edge (g, T, &locus, &block);
if (S != -1)
{
SET_BIT (g->visited, T);
- insert_partition_copy_on_edge (g->e, T, S, locus);
+ insert_partition_copy_on_edge (g->e, T, S, locus, block);
}
}
}
gcc_assert (VEC_length (tree, g->const_copies) == 0);
gcc_assert (VEC_length (source_location, g->copy_locus) == 0);
+ gcc_assert (VEC_length (tree, g->copy_block) == 0);
/* Abnormal edges already have everything coalesced. */
if (e->flags & EDGE_ABNORMAL)
int dest;
tree src;
source_location locus;
+ tree block;
src = VEC_pop (tree, g->const_copies);
dest = VEC_pop (int, g->const_dests);
locus = VEC_pop (source_location, g->copy_locus);
- insert_value_copy_on_edge (e, dest, src, locus);
+ block = VEC_pop (tree, g->copy_block);
+ insert_value_copy_on_edge (e, dest, src, locus, block);
}
}
/* copy location if present. */
if (gimple_phi_arg_has_location (phi, i))
- gimple_set_location (stmt,
- gimple_phi_arg_location (phi, i));
+ {
+ gimple_set_location (stmt,
+ gimple_phi_arg_location (phi, i));
+ gimple_set_block (stmt,
+ gimple_phi_arg_block (phi, i));
+ }
/* Insert the new statement into the block and update
the PHI node. */
basic_block store_bb;
tree local_res;
source_location locus;
+ tree block;
/* STORE_BB is the block where the phi
should be stored. It is the destination of the loop exit.
= make_ssa_name (SSA_NAME_VAR (gimple_assign_lhs (reduc->reduc_stmt)),
NULL);
locus = gimple_location (reduc->reduc_stmt);
+ block = gimple_block (reduc->reduc_stmt);
new_phi = create_phi_node (local_res, store_bb);
SSA_NAME_DEF_STMT (local_res) = new_phi;
- add_phi_arg (new_phi, reduc->init, e, locus);
+ add_phi_arg (new_phi, reduc->init, e, locus, block);
add_phi_arg (new_phi, gimple_assign_lhs (reduc->reduc_stmt),
- FALLTHRU_EDGE (loop->latch), locus);
+ FALLTHRU_EDGE (loop->latch), locus, block);
reduc->new_phi = new_phi;
return 1;
SET_PHI_RESULT (phi, t);
nphi = create_phi_node (res, orig_header);
SSA_NAME_DEF_STMT (res) = nphi;
- add_phi_arg (nphi, t, hpred, UNKNOWN_LOCATION);
+ add_phi_arg (nphi, t, hpred, UNKNOWN_LOCATION, NULL);
if (res == control)
{
for (gsi = gsi_start_phis (ex_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
source_location locus;
+ tree block;
tree def;
phi = gsi_stmt (gsi);
stmt = SSA_NAME_DEF_STMT (PHI_ARG_DEF_FROM_EDGE (phi, exit));
def = PHI_ARG_DEF_FROM_EDGE (stmt, loop_preheader_edge (loop));
locus = gimple_phi_arg_location_from_edge (stmt,
loop_preheader_edge (loop));
- add_phi_arg (phi, def, guard, locus);
+ block = gimple_phi_arg_block_from_edge (stmt,
+ loop_preheader_edge (loop));
+ add_phi_arg (phi, def, guard, locus, block);
def = PHI_ARG_DEF_FROM_EDGE (stmt, loop_latch_edge (loop));
locus = gimple_phi_arg_location_from_edge (stmt, loop_latch_edge (loop));
- add_phi_arg (phi, def, end, locus);
+ block = gimple_phi_arg_block_from_edge (stmt, loop_latch_edge (loop));
+ add_phi_arg (phi, def, end, locus, block);
}
e = redirect_edge_and_branch (exit, nexit->dest);
PENDING_STMT (e) = NULL;
use_operand_p imm;
gimple_phi_arg_set_location (phi, i, UNKNOWN_LOCATION);
+ gimple_phi_arg_set_block (phi, i ,NULL);
imm = gimple_phi_arg_imm_use_ptr (phi, i);
imm->use = gimple_phi_arg_def_ptr (phi, i);
imm->prev = NULL;
use_operand_p imm;
gimple_phi_arg_set_location (new_phi, i, UNKNOWN_LOCATION);
+ gimple_phi_arg_set_block (new_phi, i, NULL);
imm = gimple_phi_arg_imm_use_ptr (new_phi, i);
imm->use = gimple_phi_arg_def_ptr (new_phi, i);
imm->prev = NULL;
PHI points to the reallocated phi node when we return. */
void
-add_phi_arg (gimple phi, tree def, edge e, source_location locus)
+add_phi_arg (gimple phi, tree def, edge e, source_location locus, tree block)
{
basic_block bb = e->dest;
SET_PHI_ARG_DEF (phi, e->dest_idx, def);
gimple_phi_arg_set_location (phi, e->dest_idx, locus);
+ gimple_phi_arg_set_block (phi, e->dest_idx, block);
}
/* Move the location as well. */
gimple_phi_arg_set_location (phi, i,
gimple_phi_arg_location (phi, num_elem - 1));
+ gimple_phi_arg_set_block (phi, i,
+ gimple_phi_arg_block (phi, num_elem - 1));
}
/* Shrink the vector and return. Note that we do not have to clear
phi = create_phi_node (var, loop->header);
SSA_NAME_DEF_STMT (var) = phi;
- add_phi_arg (phi, init, entry, UNKNOWN_LOCATION);
- add_phi_arg (phi, next, latch, UNKNOWN_LOCATION);
+ add_phi_arg (phi, init, entry, UNKNOWN_LOCATION, NULL);
+ add_phi_arg (phi, next, latch, UNKNOWN_LOCATION, NULL);
}
}
next = VEC_index (tree, *vars, 1);
phi = create_phi_node (var, loop->header);
SSA_NAME_DEF_STMT (var) = phi;
- add_phi_arg (phi, init, entry, UNKNOWN_LOCATION);
- add_phi_arg (phi, next, latch, UNKNOWN_LOCATION);
+ add_phi_arg (phi, init, entry, UNKNOWN_LOCATION, NULL);
+ add_phi_arg (phi, next, latch, UNKNOWN_LOCATION, NULL);
}
else
{
gimple phi = gsi_stmt (gsi);
tree op;
source_location locus;
+ tree block;
/* PHIs for virtuals have no control dependency relation on them.
We are lost here and must force renaming of the symbol. */
op = gimple_phi_arg_def (phi, e2->dest_idx);
locus = gimple_phi_arg_location (phi, e2->dest_idx);
- add_phi_arg (phi, op, e, locus);
+ block = gimple_phi_arg_block (phi, e2->dest_idx);
+ add_phi_arg (phi, op, e, locus, block);
/* The resulting PHI if not dead can only be degenerate. */
gcc_assert (degenerate_phi_p (phi));
gsi_next (&gsi);
FOR_EACH_PHI_ARG (arg_p, phi, i, SSA_OP_ALL_USES)
{
tree arg = USE_FROM_PTR (arg_p);
+ int index = PHI_ARG_INDEX_FROM_USE (arg_p);
+ tree block = gimple_phi_arg_block (phi, index);
+ if (block != NULL)
+ TREE_USED (block) = true;
mark_all_vars_used (&arg, global_unused_vars);
}
}
if (gimple_phi_arg_edge (phi, i)->src == new_bb)
{
tree arg = gimple_phi_arg_def (phi, i);
- add_phi_arg (phi, arg, then_old_edge, UNKNOWN_LOCATION);
+ add_phi_arg (phi, arg, then_old_edge, UNKNOWN_LOCATION, NULL);
update_stmt (phi);
}
}
stmt = create_phi_node (vb, loop->header);
SSA_NAME_DEF_STMT (vb) = stmt;
- add_phi_arg (stmt, initial, loop_preheader_edge (loop), UNKNOWN_LOCATION);
- add_phi_arg (stmt, va, loop_latch_edge (loop), UNKNOWN_LOCATION);
+ add_phi_arg (stmt, initial, loop_preheader_edge (loop), UNKNOWN_LOCATION,
+ NULL);
+ add_phi_arg (stmt, va, loop_latch_edge (loop), UNKNOWN_LOCATION, NULL);
}
/* Add exit phis for the USE on EXIT. */
create_new_def_for (gimple_phi_result (phi), phi,
gimple_phi_result_ptr (phi));
FOR_EACH_EDGE (e, ei, exit->preds)
- add_phi_arg (phi, use, e, UNKNOWN_LOCATION);
+ add_phi_arg (phi, use, e, UNKNOWN_LOCATION, NULL);
}
/* Add exit phis for VAR that is used in LIVEIN.
use_operand_p op_p;
gimple_stmt_iterator psi;
source_location locus;
+ tree block;
for (psi = gsi_start_phis (dest); !gsi_end_p (psi); gsi_next (&psi))
{
phi = gsi_stmt (psi);
op_p = PHI_ARG_DEF_PTR_FROM_EDGE (phi, single_succ_edge (bb));
locus = gimple_phi_arg_location_from_edge (phi, single_succ_edge (bb));
+ block = gimple_phi_arg_block_from_edge (phi, single_succ_edge (bb));
name = USE_FROM_PTR (op_p);
new_name = duplicate_ssa_name (name, NULL);
new_phi = create_phi_node (new_name, bb);
SSA_NAME_DEF_STMT (new_name) = new_phi;
- add_phi_arg (new_phi, name, exit, locus);
+ add_phi_arg (new_phi, name, exit, locus, block);
SET_USE (op_p, new_name);
}
phi_rest = create_phi_node (new_init, rest);
SSA_NAME_DEF_STMT (new_init) = phi_rest;
- add_phi_arg (phi_rest, init, precond_edge, UNKNOWN_LOCATION);
- add_phi_arg (phi_rest, next, new_exit, UNKNOWN_LOCATION);
+ add_phi_arg (phi_rest, init, precond_edge, UNKNOWN_LOCATION, NULL);
+ add_phi_arg (phi_rest, next, new_exit, UNKNOWN_LOCATION, NULL);
SET_USE (op, new_init);
}
gimple newphi, new_stmt;
gimple_stmt_iterator gsi;
source_location locus;
+ tree block;
/* Check if middle_bb contains of only one store. */
if (!assign
return false;
locus = gimple_location (assign);
+ block = gimple_block (assign);
lhs = gimple_assign_lhs (assign);
rhs = gimple_assign_rhs1 (assign);
if (TREE_CODE (lhs) != MEM_REF
name = make_ssa_name (condstoretemp, new_stmt);
gimple_assign_set_lhs (new_stmt, name);
gimple_set_location (new_stmt, locus);
+ gimple_set_block (new_stmt, block);
gsi_insert_on_edge (e1, new_stmt);
/* 4) Create a PHI node at the join block, with one argument
holding the old RHS, and the other holding the temporary
where we stored the old memory contents. */
newphi = create_phi_node (condstoretemp, join_bb);
- add_phi_arg (newphi, rhs, e0, locus);
- add_phi_arg (newphi, name, e1, locus);
+ add_phi_arg (newphi, rhs, e0, locus, block);
+ add_phi_arg (newphi, name, e1, locus, block);
lhs = unshare_expr (lhs);
new_stmt = gimple_build_assign (lhs, PHI_RESULT (newphi));
{
tree lhs_base, lhs, then_rhs, else_rhs;
source_location then_locus, else_locus;
+ tree then_block, else_block;
gimple_stmt_iterator gsi;
gimple newphi, new_stmt;
else_rhs = gimple_assign_rhs1 (else_assign);
then_locus = gimple_location (then_assign);
else_locus = gimple_location (else_assign);
+ then_block = gimple_block (then_assign);
+ else_block = gimple_block (else_assign);
/* Now we've checked the constraints, so do the transformation:
1) Remove the stores. */
holding the old RHS, and the other holding the temporary
where we stored the old memory contents. */
newphi = create_phi_node (condstoretemp, join_bb);
- add_phi_arg (newphi, then_rhs, EDGE_SUCC (then_bb, 0), then_locus);
- add_phi_arg (newphi, else_rhs, EDGE_SUCC (else_bb, 0), else_locus);
+ add_phi_arg (newphi, then_rhs, EDGE_SUCC (then_bb, 0), then_locus,
+ then_block);
+ add_phi_arg (newphi, else_rhs, EDGE_SUCC (else_bb, 0), else_locus,
+ else_block);
new_stmt = gimple_build_assign (lhs, PHI_RESULT (newphi));
tree old_arg, new_var;
gimple tmp;
source_location locus;
+ tree block;
old_arg = PHI_ARG_DEF_FROM_EDGE (phi, e);
locus = gimple_phi_arg_location_from_edge (phi, e);
+ block = gimple_phi_arg_block_from_edge (phi, e);
while (TREE_CODE (old_arg) == SSA_NAME
&& (SSA_NAME_VERSION (old_arg) >= n
|| phivn[SSA_NAME_VERSION (old_arg)].value == NULL_TREE))
gimple def_stmt = SSA_NAME_DEF_STMT (old_arg);
old_arg = gimple_assign_rhs1 (def_stmt);
locus = gimple_location (def_stmt);
+ block = gimple_block (def_stmt);
}
if (TREE_CODE (old_arg) == SSA_NAME)
new_var = make_ssa_name (new_var, tmp);
gimple_assign_set_lhs (tmp, new_var);
gimple_set_location (tmp, locus);
+ gimple_set_block (tmp, block);
gsi_insert_on_edge (e, tmp);
update_stmt (tmp);
}
}
- add_phi_arg (new_phi, new_var, e, locus);
+ add_phi_arg (new_phi, new_var, e, locus, block);
}
update_stmt (new_phi);
gcc_assert (get_expr_type (ae) == type
|| useless_type_conversion_p (type, get_expr_type (ae)));
if (ae->kind == CONSTANT)
- add_phi_arg (phi, PRE_EXPR_CONSTANT (ae), pred, UNKNOWN_LOCATION);
+ add_phi_arg (phi, PRE_EXPR_CONSTANT (ae), pred, UNKNOWN_LOCATION, NULL);
else
add_phi_arg (phi, PRE_EXPR_NAME (avail[pred->src->index]), pred,
- UNKNOWN_LOCATION);
+ UNKNOWN_LOCATION, NULL);
}
newphi = get_or_alloc_expr_for_name (gimple_phi_result (phi));
bb2_phi = vop_phi (bb2);
add_phi_arg (bb2_phi, SSA_NAME_VAR (gimple_phi_result (bb2_phi)),
- pred_edge, UNKNOWN_LOCATION);
+ pred_edge, UNKNOWN_LOCATION, NULL);
}
bb2->frequency += bb1->frequency;
{
gimple phi = gsi_stmt (gsi);
source_location locus = gimple_phi_arg_location (phi, src_indx);
- add_phi_arg (phi, gimple_phi_arg_def (phi, src_indx), tgt_e, locus);
+ tree block = gimple_phi_arg_block (phi, src_indx);
+ add_phi_arg (phi, gimple_phi_arg_def (phi, src_indx), tgt_e, locus,
+ block);
}
}
/* Add a mapping with PHI RESULT and PHI DEF associated with edge E. */
void
-redirect_edge_var_map_add (edge e, tree result, tree def, source_location locus)
+redirect_edge_var_map_add (edge e, tree result, tree def, source_location locus,
+ tree block)
{
void **slot;
edge_var_map_vector old_head, head;
new_node.def = def;
new_node.result = result;
new_node.locus = locus;
+ new_node.block = block;
VEC_safe_push (edge_var_map, heap, head, &new_node);
if (old_head != head)
{
tree def;
source_location locus ;
+ tree block;
phi = gsi_stmt (gsi);
def = gimple_phi_arg_def (phi, e->dest_idx);
locus = gimple_phi_arg_location (phi, e->dest_idx);
+ block = gimple_phi_arg_block (phi, e->dest_idx);
if (def == NULL_TREE)
continue;
- redirect_edge_var_map_add (e, gimple_phi_result (phi), def, locus);
+ redirect_edge_var_map_add (e, gimple_phi_result (phi), def, locus, block);
}
e = redirect_edge_succ_nodup (e, dest);
phi = gsi_stmt (gsi);
def = redirect_edge_var_map_def (vm);
- add_phi_arg (phi, def, e, redirect_edge_var_map_location (vm));
+ add_phi_arg (phi, def, e, redirect_edge_var_map_location (vm),
+ redirect_edge_var_map_block (vm));
}
redirect_edge_var_map_clear (e);
!gsi_end_p (gsi); gsi_next (&gsi), i++)
{
gimple phi = gsi_stmt (gsi);
- add_phi_arg (phi, info->target_inbound_names[i], e1f, UNKNOWN_LOCATION);
- add_phi_arg (phi, info->target_outbound_names[i], e2f, UNKNOWN_LOCATION);
+ add_phi_arg (phi, info->target_inbound_names[i], e1f, UNKNOWN_LOCATION,
+ NULL);
+ add_phi_arg (phi, info->target_outbound_names[i], e2f, UNKNOWN_LOCATION,
+ NULL);
}
}
break;
gcc_assert (!gsi_end_p (gsi));
- add_phi_arg (gsi_stmt (gsi), phi_arg, e, UNKNOWN_LOCATION);
+ add_phi_arg (gsi_stmt (gsi), phi_arg, e, UNKNOWN_LOCATION, NULL);
}
/* Creates a GIMPLE statement which computes the operation specified by
phi = gsi_stmt (gsi);
gcc_assert (param == SSA_NAME_VAR (PHI_RESULT (phi)));
- add_phi_arg (phi, arg, e, gimple_location (stmt));
+ add_phi_arg (phi, arg, e, gimple_location (stmt), gimple_block (stmt));
gsi_next (&gsi);
}
phi = create_phi_node (tmp, bb);
/* RET_TYPE can be a float when -ffast-maths is enabled. */
add_phi_arg (phi, fold_convert (ret_type, init), single_pred_edge (bb),
- UNKNOWN_LOCATION);
+ UNKNOWN_LOCATION, NULL);
return PHI_RESULT (phi);
}
phi = create_phi_node (name, first);
SSA_NAME_DEF_STMT (name) = phi;
add_phi_arg (phi, new_name, single_pred_edge (first),
- EXPR_LOCATION (param));
+ EXPR_LOCATION (param), NULL);
}
phis_constructed = true;
}
msq = make_ssa_name (vec_dest, NULL);
phi_stmt = create_phi_node (msq, containing_loop->header);
SSA_NAME_DEF_STMT (msq) = phi_stmt;
- add_phi_arg (phi_stmt, msq_init, pe, UNKNOWN_LOCATION);
+ add_phi_arg (phi_stmt, msq_init, pe, UNKNOWN_LOCATION, NULL);
return msq;
}
gsi_next (&gsi_new), gsi_next (&gsi_orig))
{
source_location locus;
+ tree block;
phi_new = gsi_stmt (gsi_new);
phi_orig = gsi_stmt (gsi_orig);
/* step 1. */
def = PHI_ARG_DEF_FROM_EDGE (phi_orig, entry_arg_e);
locus = gimple_phi_arg_location_from_edge (phi_orig, entry_arg_e);
- add_phi_arg (phi_new, def, new_loop_entry_e, locus);
+ block = gimple_phi_arg_block_from_edge (phi_orig, entry_arg_e);
+ add_phi_arg (phi_new, def, new_loop_entry_e, locus, block);
/* step 2. */
def = PHI_ARG_DEF_FROM_EDGE (phi_orig, orig_loop_latch);
}
/* An ordinary ssa name defined in the loop. */
- add_phi_arg (phi_new, new_ssa_name, loop_latch_edge (new_loop), locus);
+ add_phi_arg (phi_new, new_ssa_name, loop_latch_edge (new_loop), locus,
+ block);
/* Drop any debug references outside the loop, if they would
become ill-formed SSA. */
gsi_next (&gsi_orig), gsi_next (&gsi_update))
{
source_location loop_locus, guard_locus;
+ tree loop_block, guard_block;
orig_phi = gsi_stmt (gsi_orig);
update_phi = gsi_stmt (gsi_update);
loop_locus = gimple_phi_arg_location_from_edge (orig_phi,
EDGE_SUCC (loop->latch,
0));
+ loop_block = gimple_phi_arg_block_from_edge (orig_phi,
+ EDGE_SUCC (loop->latch,
+ 0));
+
guard_arg = PHI_ARG_DEF_FROM_EDGE (orig_phi, loop_preheader_edge (loop));
guard_locus
= gimple_phi_arg_location_from_edge (orig_phi,
loop_preheader_edge (loop));
+ guard_block = gimple_phi_arg_block_from_edge (orig_phi,
+ loop_preheader_edge (loop));
- add_phi_arg (new_phi, loop_arg, new_exit_e, loop_locus);
- add_phi_arg (new_phi, guard_arg, guard_edge, guard_locus);
+ add_phi_arg (new_phi, loop_arg, new_exit_e, loop_locus, loop_block);
+ add_phi_arg (new_phi, guard_arg, guard_edge, guard_locus, guard_block);
/* 1.3. Update phi in successor block. */
gcc_assert (PHI_ARG_DEF_FROM_EDGE (update_phi, e) == loop_arg
*new_exit_bb);
/* 2.2. NEW_EXIT_BB has one incoming edge: the exit-edge of the loop. */
- add_phi_arg (new_phi, loop_arg, single_exit (loop), loop_locus);
+ add_phi_arg (new_phi, loop_arg, single_exit (loop), loop_locus, loop_block);
/* 2.3. Update phi in successor of NEW_EXIT_BB: */
gcc_assert (PHI_ARG_DEF_FROM_EDGE (update_phi2, new_exit_e) == loop_arg);
if (new_name2)
guard_arg = new_name2;
- add_phi_arg (new_phi, loop_arg, new_exit_e, UNKNOWN_LOCATION);
- add_phi_arg (new_phi, guard_arg, guard_edge, UNKNOWN_LOCATION);
+ add_phi_arg (new_phi, loop_arg, new_exit_e, UNKNOWN_LOCATION, NULL);
+ add_phi_arg (new_phi, guard_arg, guard_edge, UNKNOWN_LOCATION, NULL);
/* 1.3. Update phi in successor block. */
gcc_assert (PHI_ARG_DEF_FROM_EDGE (update_phi, e) == orig_def);
*new_exit_bb);
/* 2.2. NEW_EXIT_BB has one incoming edge: the exit-edge of the loop. */
- add_phi_arg (new_phi, loop_arg, single_exit (loop), UNKNOWN_LOCATION);
+ add_phi_arg (new_phi, loop_arg, single_exit (loop), UNKNOWN_LOCATION,
+ NULL);
/* 2.3. Update phi in successor of NEW_EXIT_BB: */
gcc_assert (PHI_ARG_DEF_FROM_EDGE (update_phi2, new_exit_e) == loop_arg);
/* 3.3. GUARD_BB has one incoming edge: */
gcc_assert (EDGE_COUNT (guard_edge->src->preds) == 1);
add_phi_arg (new_phi, arg, EDGE_PRED (guard_edge->src, 0),
- UNKNOWN_LOCATION);
+ UNKNOWN_LOCATION, NULL);
/* 3.4. Update phi in successor of GUARD_BB: */
gcc_assert (PHI_ARG_DEF_FROM_EDGE (update_phi2, guard_edge)
{
edge new_loop_exit_edge;
source_location locus;
+ tree block;
locus = gimple_phi_arg_location_from_edge (phi, single_exit (loop));
+ block = gimple_phi_arg_block_from_edge (phi, single_exit (loop));
if (EDGE_SUCC (new_loop->header, 0)->dest == new_loop->latch)
new_loop_exit_edge = EDGE_SUCC (new_loop->header, 1);
else
new_loop_exit_edge = EDGE_SUCC (new_loop->header, 0);
- add_phi_arg (phi, phi_arg, new_loop_exit_edge, locus);
+ add_phi_arg (phi, phi_arg, new_loop_exit_edge, locus, block);
}
}
phi_arg = PHI_ARG_DEF_FROM_EDGE (phi, entry_e);
if (phi_arg)
add_phi_arg (phi, phi_arg, new_exit_e,
- gimple_phi_arg_location_from_edge (phi, entry_e));
+ gimple_phi_arg_location_from_edge (phi, entry_e),
+ gimple_phi_arg_block_from_edge (phi, entry_e));
}
redirect_edge_and_branch_force (entry_e, new_loop->header);
newphi = create_phi_node (var, bb_before_first_loop);
add_phi_arg (newphi, prologue_after_cost_adjust_name, e_fallthru,
- UNKNOWN_LOCATION);
- add_phi_arg (newphi, *first_niters, e_false, UNKNOWN_LOCATION);
+ UNKNOWN_LOCATION, NULL);
+ add_phi_arg (newphi, *first_niters, e_false, UNKNOWN_LOCATION, NULL);
*first_niters = PHI_RESULT (newphi);
}
new_phi);
use_operand_p use_p;
- add_phi_arg (new_phi, vop, exit_e, UNKNOWN_LOCATION);
+ add_phi_arg (new_phi, vop, exit_e, UNKNOWN_LOCATION, NULL);
gimple_phi_set_result (new_phi, new_vop);
FOR_EACH_IMM_USE_STMT (stmt, imm_iter, vop)
if (stmt != new_phi && gimple_bb (stmt) != loop->header)
new_exit_bb);
arg = PHI_ARG_DEF_FROM_EDGE (orig_phi, e);
add_phi_arg (new_phi, arg, new_exit_e,
- gimple_phi_arg_location_from_edge (orig_phi, e));
+ gimple_phi_arg_location_from_edge (orig_phi, e),
+ gimple_phi_arg_block_from_edge (orig_phi, e));
adjust_phi_and_debug_stmts (orig_phi, e, PHI_RESULT (new_phi));
}
NULL));
/* Set the arguments of the phi node: */
- add_phi_arg (induction_phi, vec_init, pe, UNKNOWN_LOCATION);
+ add_phi_arg (induction_phi, vec_init, pe, UNKNOWN_LOCATION, NULL);
add_phi_arg (induction_phi, vec_def, loop_latch_edge (iv_loop),
- UNKNOWN_LOCATION);
+ UNKNOWN_LOCATION, NULL);
/* In case that vectorization factor (VF) is bigger than the number
{
/* Set the loop-entry arg of the reduction-phi. */
add_phi_arg (phi, vec_init_def, loop_preheader_edge (loop),
- UNKNOWN_LOCATION);
+ UNKNOWN_LOCATION, NULL);
/* Set the loop-latch arg for the reduction-phi. */
if (j > 0)
def = vect_get_vec_def_for_stmt_copy (vect_unknown_def_type, def);
- add_phi_arg (phi, def, loop_latch_edge (loop), UNKNOWN_LOCATION);
+ add_phi_arg (phi, def, loop_latch_edge (loop), UNKNOWN_LOCATION, NULL);
if (vect_print_dump_info (REPORT_DETAILS))
{
/* Update phi node arguments with vs0 and vs2. */
add_phi_arg (vect_phi, vect_phi_init,
loop_preheader_edge (outer_loop),
- UNKNOWN_LOCATION);
+ UNKNOWN_LOCATION, NULL);
add_phi_arg (vect_phi, PHI_RESULT (inner_phi),
- loop_latch_edge (outer_loop), UNKNOWN_LOCATION);
+ loop_latch_edge (outer_loop), UNKNOWN_LOCATION,
+ NULL);
if (vect_print_dump_info (REPORT_DETAILS))
{
fprintf (vect_dump, "created double reduction phi "
if (i == vec_num - 1 && j == ncopies - 1)
add_phi_arg (phi, lsq,
loop_latch_edge (containing_loop),
- UNKNOWN_LOCATION);
+ UNKNOWN_LOCATION, NULL);
msq = lsq;
}
}
pointer arithmetic with it. See phi_arg_index_from_use. */
struct ssa_use_operand_d imm_use;
tree def;
+ tree block;
location_t locus;
};
SSA_NAME_DEF_STMT (result) = phi;
gimple_call_set_lhs (icall_stmt,
make_ssa_name (SSA_NAME_VAR (result), icall_stmt));
- add_phi_arg (phi, gimple_call_lhs (icall_stmt), e_ij, UNKNOWN_LOCATION);
+ add_phi_arg (phi, gimple_call_lhs (icall_stmt), e_ij, UNKNOWN_LOCATION,
+ NULL);
gimple_call_set_lhs (dcall_stmt,
make_ssa_name (SSA_NAME_VAR (result), dcall_stmt));
- add_phi_arg (phi, gimple_call_lhs (dcall_stmt), e_dj, UNKNOWN_LOCATION);
+ add_phi_arg (phi, gimple_call_lhs (dcall_stmt), e_dj, UNKNOWN_LOCATION,
+ NULL);
}
/* Build an EH edge for the direct call if necessary. */
SSA_NAME_DEF_STMT (result) = phi;
gimple_call_set_lhs (vcall_stmt,
make_ssa_name (SSA_NAME_VAR (result), vcall_stmt));
- add_phi_arg (phi, gimple_call_lhs (vcall_stmt), e_vj, UNKNOWN_LOCATION);
+ add_phi_arg (phi, gimple_call_lhs (vcall_stmt), e_vj, UNKNOWN_LOCATION,
+ NULL);
gimple_call_set_lhs (icall_stmt,
make_ssa_name (SSA_NAME_VAR (result), icall_stmt));
- add_phi_arg (phi, gimple_call_lhs (icall_stmt), e_ij, UNKNOWN_LOCATION);
+ add_phi_arg (phi, gimple_call_lhs (icall_stmt), e_ij, UNKNOWN_LOCATION,
+ NULL);
}
/* Because these are all string op builtins, they're all nothrow. */