gimple.h (gimple_phi_set_result): Adjust SSA_NAME_DEF_STMT.

2012-08-07  Richard Guenther  <rguenther@suse.de>

	* gimple.h (gimple_phi_set_result): Adjust SSA_NAME_DEF_STMT.
	* tree-phinodes.c (make_phi_node): Allow a NULL var.
	* tree-into-ssa.c (insert_phi_nodes_for): Simplify.
	* tree-complex.c (update_phi_components): Likewise.
	* tree-ssa-loop-manip.c (create_iv): Likewise.
	(add_exit_phis_edge): Likewise.
	(split_loop_exit_edge): Likewise.
	(tree_transform_and_unroll_loop): Likewise.
	* value-prof.c (gimple_ic): Likewise.
	(gimple_stringop_fixed_value): Likewise.
	* tree-tailcall.c (tree_optimize_tail_calls_1): Likewise.
	* omp-low.c (expand_parallel_call): Likewise.
	(expand_omp_for_static_chunk): Likewise.
	(expand_omp_atomic_pipeline): Likewise.
	* tree-parloops.c (create_phi_for_local_result): Likewise.
	(transform_to_exit_first_loop): Likewise.
	* tree-vect-data-refs.c (vect_setup_realignment): Likewise.
	* graphite-scop-detection.c (canonicalize_loop_closed_ssa): Likewise.
	* tree-predcom.c (initialize_root_vars): Likewise.
	(initialize_root_vars_lm): Likewise.
	* sese.c (sese_add_exit_phis_edge): Likewise.
	* gimple-streamer-in.c (input_phi): Likewise.
	* tree-inline.c (copy_phis_for_bb): Likewise.
	* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
	* tree-cfg.c (gimple_make_forwarder_block): Likewise.
	(gimple_duplicate_bb): Likewise.

From-SVN: r190199
This commit is contained in:
Richard Guenther 2012-08-07 10:36:01 +00:00 committed by Richard Biener
parent d13abe1e88
commit dcc748dd77
18 changed files with 48 additions and 45 deletions

View File

@ -1,3 +1,32 @@
2012-08-07 Richard Guenther <rguenther@suse.de>
* gimple.h (gimple_phi_set_result): Adjust SSA_NAME_DEF_STMT.
* tree-phinodes.c (make_phi_node): Allow a NULL var.
* tree-into-ssa.c (insert_phi_nodes_for): Simplify.
* tree-complex.c (update_phi_components): Likewise.
* tree-ssa-loop-manip.c (create_iv): Likewise.
(add_exit_phis_edge): Likewise.
(split_loop_exit_edge): Likewise.
(tree_transform_and_unroll_loop): Likewise.
* value-prof.c (gimple_ic): Likewise.
(gimple_stringop_fixed_value): Likewise.
* tree-tailcall.c (tree_optimize_tail_calls_1): Likewise.
* omp-low.c (expand_parallel_call): Likewise.
(expand_omp_for_static_chunk): Likewise.
(expand_omp_atomic_pipeline): Likewise.
* tree-parloops.c (create_phi_for_local_result): Likewise.
(transform_to_exit_first_loop): Likewise.
* tree-vect-data-refs.c (vect_setup_realignment): Likewise.
* graphite-scop-detection.c (canonicalize_loop_closed_ssa): Likewise.
* tree-predcom.c (initialize_root_vars): Likewise.
(initialize_root_vars_lm): Likewise.
* sese.c (sese_add_exit_phis_edge): Likewise.
* gimple-streamer-in.c (input_phi): Likewise.
* tree-inline.c (copy_phis_for_bb): Likewise.
* tree-ssa-phiprop.c (phiprop_insert_phi): Likewise.
* tree-cfg.c (gimple_make_forwarder_block): Likewise.
(gimple_duplicate_bb): Likewise.
2012-08-07 Nick Clifton <nickc@redhat.com>
* config/mn10300/mn10300.c (mn10300_expand_prologue): Report

View File

@ -45,7 +45,6 @@ input_phi (struct lto_input_block *ib, basic_block bb, struct data_in *data_in,
phi_result = VEC_index (tree, SSANAMES (fn), ix);
len = EDGE_COUNT (bb->preds);
result = create_phi_node (phi_result, bb);
SSA_NAME_DEF_STMT (phi_result) = result;
/* We have to go through a lookup process here because the preds in the
reconstructed graph are generally in a different order than they

View File

@ -3494,6 +3494,8 @@ gimple_phi_set_result (gimple gs, tree result)
{
GIMPLE_CHECK (gs, GIMPLE_PHI);
gs->gimple_phi.result = result;
if (result && TREE_CODE (result) == SSA_NAME)
SSA_NAME_DEF_STMT (result) = gs;
}

View File

@ -1325,9 +1325,8 @@ canonicalize_loop_closed_ssa (loop_p loop)
if (TREE_CODE (arg) != SSA_NAME)
continue;
close_phi = create_phi_node (arg, close);
res = create_new_def_for (gimple_phi_result (close_phi),
close_phi,
close_phi = create_phi_node (NULL_TREE, close);
res = create_new_def_for (arg, close_phi,
gimple_phi_result_ptr (close_phi));
add_phi_arg (close_phi, arg,
gimple_phi_arg_edge (close_phi, 0),

View File

@ -3059,7 +3059,6 @@ expand_parallel_call (struct omp_region *region, basic_block bb,
if (gimple_in_ssa_p (cfun))
{
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);
}
@ -4592,7 +4591,6 @@ expand_omp_for_static_chunk (struct omp_region *region, struct omp_for_data *fd)
t = gimple_phi_result (phi);
gcc_assert (t == redirect_edge_var_map_result (vm));
nphi = create_phi_node (t, iter_part_bb);
SSA_NAME_DEF_STMT (t) = nphi;
t = PHI_ARG_DEF_FROM_EDGE (phi, se);
locus = gimple_phi_arg_location_from_edge (phi, se);
@ -4617,7 +4615,6 @@ expand_omp_for_static_chunk (struct omp_region *region, struct omp_for_data *fd)
/* Make phi node for trip. */
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);
add_phi_arg (phi, trip_init, single_succ_edge (entry_bb),
@ -5319,7 +5316,6 @@ expand_omp_atomic_pipeline (basic_block load_bb, basic_block store_bb,
{
gcc_assert (gimple_seq_empty_p (phi_nodes (loop_header)));
phi = create_phi_node (loadedi, loop_header);
SSA_NAME_DEF_STMT (loadedi) = phi;
SET_USE (PHI_ARG_DEF_PTR_FROM_EDGE (phi, single_succ_edge (load_bb)),
initial);
}

View File

@ -345,10 +345,8 @@ free_sese (sese region)
static void
sese_add_exit_phis_edge (basic_block exit, tree use, edge false_e, edge true_e)
{
gimple phi = create_phi_node (use, exit);
create_new_def_for (gimple_phi_result (phi), phi,
gimple_phi_result_ptr (phi));
gimple phi = create_phi_node (NULL_TREE, exit);
create_new_def_for (use, phi, gimple_phi_result_ptr (phi));
add_phi_arg (phi, use, false_e, UNKNOWN_LOCATION);
add_phi_arg (phi, use, true_e, UNKNOWN_LOCATION);
}

View File

@ -5010,7 +5010,6 @@ gimple_make_forwarder_block (edge fallthru)
phi = gsi_stmt (gsi);
var = gimple_phi_result (phi);
new_phi = create_phi_node (var, bb);
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);
@ -5370,8 +5369,8 @@ gimple_duplicate_bb (basic_block bb)
for (gsi = gsi_start (phis); !gsi_end_p (gsi); gsi_next (&gsi))
{
phi = gsi_stmt (gsi);
copy = create_phi_node (gimple_phi_result (phi), new_bb);
create_new_def_for (gimple_phi_result (copy), copy,
copy = create_phi_node (NULL_TREE, new_bb);
create_new_def_for (gimple_phi_result (phi), copy,
gimple_phi_result_ptr (copy));
}

View File

@ -720,17 +720,11 @@ update_phi_components (basic_block bb)
lr = get_component_ssa_name (gimple_phi_result (phi), false);
if (TREE_CODE (lr) == SSA_NAME)
{
pr = create_phi_node (lr, bb);
SSA_NAME_DEF_STMT (lr) = pr;
}
pr = create_phi_node (lr, bb);
li = get_component_ssa_name (gimple_phi_result (phi), true);
if (TREE_CODE (li) == SSA_NAME)
{
pi = create_phi_node (li, bb);
SSA_NAME_DEF_STMT (li) = pi;
}
pi = create_phi_node (li, bb);
for (i = 0, n = gimple_phi_num_args (phi); i < n; ++i)
{

View File

@ -1941,8 +1941,7 @@ copy_phis_for_bb (basic_block bb, copy_body_data *id)
if (is_gimple_reg (res))
{
walk_tree (&new_res, copy_tree_body_r, id, NULL);
SSA_NAME_DEF_STMT (new_res)
= new_phi = create_phi_node (new_res, new_bb);
new_phi = create_phi_node (new_res, new_bb);
FOR_EACH_EDGE (new_edge, ei, new_bb->preds)
{
edge old_edge = find_edge ((basic_block) new_edge->src->aux, bb);

View File

@ -1039,10 +1039,8 @@ insert_phi_nodes_for (tree var, bitmap phi_insertion_points, bool update_p)
tree new_lhs;
gcc_assert (update_p);
phi = create_phi_node (var, bb);
new_lhs = duplicate_ssa_name (var, phi);
gimple_phi_set_result (phi, new_lhs);
new_lhs = duplicate_ssa_name (var, NULL);
phi = create_phi_node (new_lhs, bb);
add_new_name_mapping (new_lhs, var);
/* Add VAR to every argument slot of PHI. We need VAR in

View File

@ -1013,7 +1013,6 @@ create_phi_for_local_result (void **slot, void *data)
NULL);
locus = gimple_location (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, gimple_assign_lhs (reduc->reduc_stmt),
FALLTHRU_EDGE (loop->latch), locus);
@ -1489,7 +1488,6 @@ transform_to_exit_first_loop (struct loop *loop, htab_t reduction_list, tree nit
t = make_ssa_name (SSA_NAME_VAR (res), phi);
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);
if (res == control)

View File

@ -189,7 +189,9 @@ make_phi_node (tree var, int len)
gimple_init_singleton (phi);
phi->gimple_phi.nargs = len;
phi->gimple_phi.capacity = capacity;
if (TREE_CODE (var) == SSA_NAME)
if (!var)
;
else if (TREE_CODE (var) == SSA_NAME)
gimple_phi_set_result (phi, var);
else
gimple_phi_set_result (phi, make_ssa_name (var, phi));

View File

@ -1495,7 +1495,6 @@ initialize_root_vars (struct loop *loop, chain_p chain, bitmap tmp_vars)
gsi_insert_seq_on_edge_immediate (entry, stmts);
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);
}
@ -1559,7 +1558,6 @@ initialize_root_vars_lm (struct loop *loop, dref root, bool written,
{
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);
}

View File

@ -116,7 +116,6 @@ create_iv (tree base, tree step, tree var, struct loop *loop,
gsi_insert_seq_on_edge_immediate (pe, stmts);
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);
}
@ -144,9 +143,8 @@ add_exit_phis_edge (basic_block exit, tree use)
if (!e)
return;
phi = create_phi_node (use, exit);
create_new_def_for (gimple_phi_result (phi), phi,
gimple_phi_result_ptr (phi));
phi = create_phi_node (NULL_TREE, exit);
create_new_def_for (use, phi, gimple_phi_result_ptr (phi));
FOR_EACH_EDGE (e, ei, exit->preds)
add_phi_arg (phi, use, e, UNKNOWN_LOCATION);
}
@ -499,7 +497,6 @@ split_loop_exit_edge (edge exit)
of the SSA name out of the loop. */
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);
SET_USE (op_p, new_name);
}
@ -1012,7 +1009,6 @@ tree_transform_and_unroll_loop (struct loop *loop, unsigned factor,
new_init = make_ssa_name (var, NULL);
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);

View File

@ -141,7 +141,7 @@ phiprop_insert_phi (basic_block bb, gimple phi, gimple use_stmt,
/* Build a new PHI node to replace the definition of
the indirect reference lhs. */
res = gimple_assign_lhs (use_stmt);
SSA_NAME_DEF_STMT (res) = new_phi = create_phi_node (res, bb);
new_phi = create_phi_node (res, bb);
if (dump_file && (dump_flags & TDF_DETAILS))
{

View File

@ -975,7 +975,6 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
set_ssa_default_def (cfun, param, new_name);
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));
}

View File

@ -4446,7 +4446,6 @@ vect_setup_realignment (gimple stmt, gimple_stmt_iterator *gsi,
vec_dest = vect_create_destination_var (scalar_dest, vectype);
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);
return msq;

View File

@ -1275,7 +1275,6 @@ gimple_ic (gimple icall_stmt, struct cgraph_node *direct_call,
{
tree result = gimple_call_lhs (icall_stmt);
gimple phi = create_phi_node (result, join_bb);
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);
@ -1507,7 +1506,6 @@ gimple_stringop_fixed_value (gimple vcall_stmt, tree icall_size, int prob,
{
tree result = gimple_call_lhs (vcall_stmt);
gimple phi = create_phi_node (result, join_bb);
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);