Commit 070ecdfd by Richard Guenther Committed by Richard Biener

tree-flow.h (copy_ssa_name_fn): New function.

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

	* tree-flow.h (copy_ssa_name_fn): New function.
	(duplicate_ssa_name_fn): Likewise.
	* tree-flow-inline.h (copy_ssa_name): New function.
	(duplicate_ssa_name): Likewise.
	* tree-ssanames.c (copy_ssa_name_fn): New function.
	(duplicate_ssa_name): Rename to ...
	(duplicate_ssa_name_fn): ... this and adjust.
	* tree-tailcall.c (update_accumulator_with_ops): Use copy_ssa_name.
	* tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1): Likewise.
	(slpeel_update_phi_nodes_for_guard2): Likewise.
	(slpeel_tree_peel_loop_to_edge): Likewise.
	(vect_loop_versioning): Likewise.
	* tree-parloops.c (transform_to_exit_first_loop): Likewise.
	(create_parallel_loop): Likewise.
	* ipa-split.c (split_function): Likewise.
	* tree-vect-loop.c (vect_is_simple_reduction_1): Likewise.
	(vect_create_epilog_for_reduction): Likewise.
	* tree-vect-data-refs.c (bump_vector_ptr): Likewise.
	(vect_setup_realignment): Likewise.
	* tree-vect-stmts.c (vectorizable_load): Likewise.
	* tree-switch-conversion.c (build_one_array): Likewise.
	(gen_def_assigns): Likewise.
	* tree-cfg.c (gimple_make_forwarder_block): Likewise.
	* graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Call
	create_zero_dim_array with the SSA name.
	(rewrite_phi_out_of_ssa): Likewise.
	(rewrite_cross_bb_scalar_dependence): Likewise.  Use copy_ssa_name.

From-SVN: r190202
parent 01c59d23
2012-08-07 Richard Guenther <rguenther@suse.de> 2012-08-07 Richard Guenther <rguenther@suse.de>
* tree-flow.h (copy_ssa_name_fn): New function.
(duplicate_ssa_name_fn): Likewise.
* tree-flow-inline.h (copy_ssa_name): New function.
(duplicate_ssa_name): Likewise.
* tree-ssanames.c (copy_ssa_name_fn): New function.
(duplicate_ssa_name): Rename to ...
(duplicate_ssa_name_fn): ... this and adjust.
* tree-tailcall.c (update_accumulator_with_ops): Use copy_ssa_name.
* tree-vect-loop-manip.c (slpeel_update_phi_nodes_for_guard1): Likewise.
(slpeel_update_phi_nodes_for_guard2): Likewise.
(slpeel_tree_peel_loop_to_edge): Likewise.
(vect_loop_versioning): Likewise.
* tree-parloops.c (transform_to_exit_first_loop): Likewise.
(create_parallel_loop): Likewise.
* ipa-split.c (split_function): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction_1): Likewise.
(vect_create_epilog_for_reduction): Likewise.
* tree-vect-data-refs.c (bump_vector_ptr): Likewise.
(vect_setup_realignment): Likewise.
* tree-vect-stmts.c (vectorizable_load): Likewise.
* tree-switch-conversion.c (build_one_array): Likewise.
(gen_def_assigns): Likewise.
* tree-cfg.c (gimple_make_forwarder_block): Likewise.
* graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Call
create_zero_dim_array with the SSA name.
(rewrite_phi_out_of_ssa): Likewise.
(rewrite_cross_bb_scalar_dependence): Likewise. Use copy_ssa_name.
2012-08-07 Richard Guenther <rguenther@suse.de>
* tree-dfa.c (set_ssa_default_def): Clear the SSA_NAME_DEFAULT_DEF * tree-dfa.c (set_ssa_default_def): Clear the SSA_NAME_DEFAULT_DEF
bit of the old name when we clear the slot. bit of the old name when we clear the slot.
* tree-ssa-live.c (remove_unused_locals): Release any default * tree-ssa-live.c (remove_unused_locals): Release any default
......
...@@ -2166,7 +2166,6 @@ rewrite_close_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi) ...@@ -2166,7 +2166,6 @@ rewrite_close_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi)
sese region = SCOP_REGION (scop); sese region = SCOP_REGION (scop);
gimple phi = gsi_stmt (*psi); gimple phi = gsi_stmt (*psi);
tree res = gimple_phi_result (phi); tree res = gimple_phi_result (phi);
tree var = SSA_NAME_VAR (res);
basic_block bb = gimple_bb (phi); basic_block bb = gimple_bb (phi);
gimple_stmt_iterator gsi = gsi_after_labels (bb); gimple_stmt_iterator gsi = gsi_after_labels (bb);
tree arg = gimple_phi_arg_def (phi, 0); tree arg = gimple_phi_arg_def (phi, 0);
...@@ -2222,7 +2221,7 @@ rewrite_close_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi) ...@@ -2222,7 +2221,7 @@ rewrite_close_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi)
} }
else else
{ {
tree zero_dim_array = create_zero_dim_array (var, "Close_Phi"); tree zero_dim_array = create_zero_dim_array (res, "Close_Phi");
stmt = gimple_build_assign (res, zero_dim_array); stmt = gimple_build_assign (res, zero_dim_array);
...@@ -2250,8 +2249,8 @@ rewrite_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi) ...@@ -2250,8 +2249,8 @@ rewrite_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi)
gimple phi = gsi_stmt (*psi); gimple phi = gsi_stmt (*psi);
basic_block bb = gimple_bb (phi); basic_block bb = gimple_bb (phi);
tree res = gimple_phi_result (phi); tree res = gimple_phi_result (phi);
tree var = SSA_NAME_VAR (res); tree var;
tree zero_dim_array = create_zero_dim_array (var, "phi_out_of_ssa"); tree zero_dim_array = create_zero_dim_array (res, "phi_out_of_ssa");
gimple stmt; gimple stmt;
gimple_seq stmts; gimple_seq stmts;
...@@ -2349,14 +2348,16 @@ static void ...@@ -2349,14 +2348,16 @@ static void
rewrite_cross_bb_scalar_dependence (scop_p scop, tree zero_dim_array, rewrite_cross_bb_scalar_dependence (scop_p scop, tree zero_dim_array,
tree def, gimple use_stmt) tree def, gimple use_stmt)
{ {
tree var = SSA_NAME_VAR (def); gimple name_stmt;
gimple name_stmt = gimple_build_assign (var, zero_dim_array); tree name;
tree name = make_ssa_name (var, name_stmt);
ssa_op_iter iter; ssa_op_iter iter;
use_operand_p use_p; use_operand_p use_p;
gcc_assert (gimple_code (use_stmt) != GIMPLE_PHI); gcc_assert (gimple_code (use_stmt) != GIMPLE_PHI);
name = copy_ssa_name (def, NULL);
name_stmt = gimple_build_assign (name, zero_dim_array);
gimple_assign_set_lhs (name_stmt, name); gimple_assign_set_lhs (name_stmt, name);
insert_stmts (scop, name_stmt, NULL, gsi_for_stmt (use_stmt)); insert_stmts (scop, name_stmt, NULL, gsi_for_stmt (use_stmt));
...@@ -2480,7 +2481,7 @@ rewrite_cross_bb_scalar_deps (scop_p scop, gimple_stmt_iterator *gsi) ...@@ -2480,7 +2481,7 @@ rewrite_cross_bb_scalar_deps (scop_p scop, gimple_stmt_iterator *gsi)
if (!zero_dim_array) if (!zero_dim_array)
{ {
zero_dim_array = create_zero_dim_array zero_dim_array = create_zero_dim_array
(SSA_NAME_VAR (def), "Cross_BB_scalar_dependence"); (def, "Cross_BB_scalar_dependence");
insert_out_of_ssa_copy (scop, zero_dim_array, def, insert_out_of_ssa_copy (scop, zero_dim_array, def,
SSA_NAME_DEF_STMT (def)); SSA_NAME_DEF_STMT (def));
gsi_next (gsi); gsi_next (gsi);
......
...@@ -1267,7 +1267,7 @@ split_function (struct split_point *split_point) ...@@ -1267,7 +1267,7 @@ split_function (struct split_point *split_point)
if (TREE_CODE (retval) == SSA_NAME if (TREE_CODE (retval) == SSA_NAME
&& !DECL_BY_REFERENCE (DECL_RESULT (current_function_decl))) && !DECL_BY_REFERENCE (DECL_RESULT (current_function_decl)))
{ {
retval = make_ssa_name (SSA_NAME_VAR (retval), call); retval = copy_ssa_name (retval, call);
/* See if there is PHI defining return value. */ /* See if there is PHI defining return value. */
for (psi = gsi_start_phis (return_bb); for (psi = gsi_start_phis (return_bb);
......
...@@ -5018,7 +5018,7 @@ gimple_make_forwarder_block (edge fallthru) ...@@ -5018,7 +5018,7 @@ gimple_make_forwarder_block (edge fallthru)
phi = gsi_stmt (gsi); phi = gsi_stmt (gsi);
var = gimple_phi_result (phi); var = gimple_phi_result (phi);
new_phi = create_phi_node (var, bb); new_phi = create_phi_node (var, bb);
gimple_phi_set_result (phi, make_ssa_name (SSA_NAME_VAR (var), phi)); gimple_phi_set_result (phi, copy_ssa_name (var, phi));
add_phi_arg (new_phi, gimple_phi_result (phi), fallthru, add_phi_arg (new_phi, gimple_phi_result (phi), fallthru,
UNKNOWN_LOCATION); UNKNOWN_LOCATION);
} }
......
...@@ -1144,6 +1144,25 @@ make_ssa_name (tree var, gimple stmt) ...@@ -1144,6 +1144,25 @@ make_ssa_name (tree var, gimple stmt)
return make_ssa_name_fn (cfun, var, stmt); return make_ssa_name_fn (cfun, var, stmt);
} }
/* Return an SSA_NAME node using the template SSA name NAME defined in
statement STMT in function cfun. */
static inline tree
copy_ssa_name (tree var, gimple stmt)
{
return copy_ssa_name_fn (cfun, var, stmt);
}
/* Creates a duplicate of a SSA name NAME tobe defined by statement STMT
in function cfun. */
static inline tree
duplicate_ssa_name (tree var, gimple stmt)
{
return duplicate_ssa_name_fn (cfun, var, stmt);
}
/* Returns the base object and a constant BITS_PER_UNIT offset in *POFFSET that /* Returns the base object and a constant BITS_PER_UNIT offset in *POFFSET that
denotes the starting address of the memory access EXP. denotes the starting address of the memory access EXP.
Returns NULL_TREE if the offset is not constant or any component Returns NULL_TREE if the offset is not constant or any component
......
...@@ -530,7 +530,8 @@ void set_current_def (tree, tree); ...@@ -530,7 +530,8 @@ void set_current_def (tree, tree);
extern void init_ssanames (struct function *, int); extern void init_ssanames (struct function *, int);
extern void fini_ssanames (void); extern void fini_ssanames (void);
extern tree make_ssa_name_fn (struct function *, tree, gimple); extern tree make_ssa_name_fn (struct function *, tree, gimple);
extern tree duplicate_ssa_name (tree, gimple); extern tree copy_ssa_name_fn (struct function *, tree, gimple);
extern tree duplicate_ssa_name_fn (struct function *, tree, gimple);
extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *); extern void duplicate_ssa_name_ptr_info (tree, struct ptr_info_def *);
extern void release_ssa_name (tree); extern void release_ssa_name (tree);
extern void release_defs (gimple); extern void release_defs (gimple);
......
...@@ -1485,7 +1485,7 @@ transform_to_exit_first_loop (struct loop *loop, htab_t reduction_list, tree nit ...@@ -1485,7 +1485,7 @@ transform_to_exit_first_loop (struct loop *loop, htab_t reduction_list, tree nit
{ {
phi = gsi_stmt (gsi); phi = gsi_stmt (gsi);
res = PHI_RESULT (phi); res = PHI_RESULT (phi);
t = make_ssa_name (SSA_NAME_VAR (res), phi); t = copy_ssa_name (res, phi);
SET_PHI_RESULT (phi, t); SET_PHI_RESULT (phi, t);
nphi = create_phi_node (res, orig_header); nphi = create_phi_node (res, orig_header);
add_phi_arg (nphi, t, hpred, UNKNOWN_LOCATION); add_phi_arg (nphi, t, hpred, UNKNOWN_LOCATION);
...@@ -1623,7 +1623,7 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data, ...@@ -1623,7 +1623,7 @@ create_parallel_loop (struct loop *loop, tree loop_fn, tree data,
cvar_base = SSA_NAME_VAR (cvar); cvar_base = SSA_NAME_VAR (cvar);
phi = SSA_NAME_DEF_STMT (cvar); phi = SSA_NAME_DEF_STMT (cvar);
cvar_init = PHI_ARG_DEF_FROM_EDGE (phi, loop_preheader_edge (loop)); cvar_init = PHI_ARG_DEF_FROM_EDGE (phi, loop_preheader_edge (loop));
initvar = make_ssa_name (cvar_base, NULL); initvar = copy_ssa_name (cvar, NULL);
SET_USE (PHI_ARG_DEF_PTR_FROM_EDGE (phi, loop_preheader_edge (loop)), SET_USE (PHI_ARG_DEF_PTR_FROM_EDGE (phi, loop_preheader_edge (loop)),
initvar); initvar);
cvar_next = PHI_ARG_DEF_FROM_EDGE (phi, loop_latch_edge (loop)); cvar_next = PHI_ARG_DEF_FROM_EDGE (phi, loop_latch_edge (loop));
......
...@@ -312,6 +312,17 @@ get_ptr_info (tree t) ...@@ -312,6 +312,17 @@ get_ptr_info (tree t)
return pi; return pi;
} }
/* Creates a new SSA name using the template NAME tobe defined by
statement STMT in function FN. */
tree
copy_ssa_name_fn (struct function *fn, tree name, gimple stmt)
{
return make_ssa_name_fn (fn, SSA_NAME_VAR (name), stmt);
}
/* Creates a duplicate of the ptr_info_def at PTR_INFO for use by /* Creates a duplicate of the ptr_info_def at PTR_INFO for use by
the SSA name NAME. */ the SSA name NAME. */
...@@ -333,12 +344,13 @@ duplicate_ssa_name_ptr_info (tree name, struct ptr_info_def *ptr_info) ...@@ -333,12 +344,13 @@ duplicate_ssa_name_ptr_info (tree name, struct ptr_info_def *ptr_info)
} }
/* Creates a duplicate of a ssa name NAME tobe defined by statement STMT. */ /* Creates a duplicate of a ssa name NAME tobe defined by statement STMT
in function FN. */
tree tree
duplicate_ssa_name (tree name, gimple stmt) duplicate_ssa_name_fn (struct function *fn, tree name, gimple stmt)
{ {
tree new_name = make_ssa_name (SSA_NAME_VAR (name), stmt); tree new_name = copy_ssa_name_fn (fn, name, stmt);
struct ptr_info_def *old_ptr_info = SSA_NAME_PTR_INFO (name); struct ptr_info_def *old_ptr_info = SSA_NAME_PTR_INFO (name);
if (old_ptr_info) if (old_ptr_info)
......
...@@ -1031,7 +1031,7 @@ build_one_array (gimple swtch, int num, tree arr_index_type, gimple phi, ...@@ -1031,7 +1031,7 @@ build_one_array (gimple swtch, int num, tree arr_index_type, gimple phi,
gcc_assert (info->default_values[num]); gcc_assert (info->default_values[num]);
name = make_ssa_name (SSA_NAME_VAR (PHI_RESULT (phi)), NULL); name = copy_ssa_name (PHI_RESULT (phi), NULL);
info->target_inbound_names[num] = name; info->target_inbound_names[num] = name;
cst = constructor_contains_same_values_p (info->constructors[num]); cst = constructor_contains_same_values_p (info->constructors[num]);
...@@ -1077,7 +1077,6 @@ build_one_array (gimple swtch, int num, tree arr_index_type, gimple phi, ...@@ -1077,7 +1077,6 @@ build_one_array (gimple swtch, int num, tree arr_index_type, gimple phi,
load = gimple_build_assign (name, fetch); load = gimple_build_assign (name, fetch);
} }
SSA_NAME_DEF_STMT (name) = load;
gsi_insert_before (&gsi, load, GSI_SAME_STMT); gsi_insert_before (&gsi, load, GSI_SAME_STMT);
update_stmt (load); update_stmt (load);
info->arr_ref_last = load; info->arr_ref_last = load;
...@@ -1137,12 +1136,9 @@ gen_def_assigns (gimple_stmt_iterator *gsi, struct switch_conv_info *info) ...@@ -1137,12 +1136,9 @@ gen_def_assigns (gimple_stmt_iterator *gsi, struct switch_conv_info *info)
for (i = 0; i < info->phi_count; i++) for (i = 0; i < info->phi_count; i++)
{ {
tree name tree name = copy_ssa_name (info->target_inbound_names[i], NULL);
= make_ssa_name (SSA_NAME_VAR (info->target_inbound_names[i]), NULL);
info->target_outbound_names[i] = name; info->target_outbound_names[i] = name;
assign = gimple_build_assign (name, info->default_values[i]); assign = gimple_build_assign (name, info->default_values[i]);
SSA_NAME_DEF_STMT (name) = assign;
gsi_insert_before (gsi, assign, GSI_SAME_STMT); gsi_insert_before (gsi, assign, GSI_SAME_STMT);
update_stmt (assign); update_stmt (assign);
} }
......
...@@ -644,9 +644,9 @@ update_accumulator_with_ops (enum tree_code code, tree acc, tree op1, ...@@ -644,9 +644,9 @@ update_accumulator_with_ops (enum tree_code code, tree acc, tree op1,
gimple_stmt_iterator gsi) gimple_stmt_iterator gsi)
{ {
gimple stmt; gimple stmt;
tree var; tree var = copy_ssa_name (acc, NULL);
if (types_compatible_p (TREE_TYPE (acc), TREE_TYPE (op1))) if (types_compatible_p (TREE_TYPE (acc), TREE_TYPE (op1)))
stmt = gimple_build_assign_with_ops (code, SSA_NAME_VAR (acc), acc, op1); stmt = gimple_build_assign_with_ops (code, var, acc, op1);
else else
{ {
tree rhs = fold_convert (TREE_TYPE (acc), tree rhs = fold_convert (TREE_TYPE (acc),
...@@ -656,11 +656,8 @@ update_accumulator_with_ops (enum tree_code code, tree acc, tree op1, ...@@ -656,11 +656,8 @@ update_accumulator_with_ops (enum tree_code code, tree acc, tree op1,
op1)); op1));
rhs = force_gimple_operand_gsi (&gsi, rhs, rhs = force_gimple_operand_gsi (&gsi, rhs,
false, NULL, false, GSI_CONTINUE_LINKING); false, NULL, false, GSI_CONTINUE_LINKING);
stmt = gimple_build_assign (NULL_TREE, rhs); stmt = gimple_build_assign (var, rhs);
} }
var = make_ssa_name (SSA_NAME_VAR (acc), stmt);
gimple_assign_set_lhs (stmt, var);
update_stmt (stmt);
gsi_insert_after (&gsi, stmt, GSI_NEW_STMT); gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
return var; return var;
} }
......
...@@ -3941,7 +3941,6 @@ bump_vector_ptr (tree dataref_ptr, gimple ptr_incr, gimple_stmt_iterator *gsi, ...@@ -3941,7 +3941,6 @@ bump_vector_ptr (tree dataref_ptr, gimple ptr_incr, gimple_stmt_iterator *gsi,
stmt_vec_info stmt_info = vinfo_for_stmt (stmt); stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info); struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info);
tree vectype = STMT_VINFO_VECTYPE (stmt_info); tree vectype = STMT_VINFO_VECTYPE (stmt_info);
tree ptr_var = SSA_NAME_VAR (dataref_ptr);
tree update = TYPE_SIZE_UNIT (vectype); tree update = TYPE_SIZE_UNIT (vectype);
gimple incr_stmt; gimple incr_stmt;
ssa_op_iter iter; ssa_op_iter iter;
...@@ -3951,10 +3950,9 @@ bump_vector_ptr (tree dataref_ptr, gimple ptr_incr, gimple_stmt_iterator *gsi, ...@@ -3951,10 +3950,9 @@ bump_vector_ptr (tree dataref_ptr, gimple ptr_incr, gimple_stmt_iterator *gsi,
if (bump) if (bump)
update = bump; update = bump;
incr_stmt = gimple_build_assign_with_ops (POINTER_PLUS_EXPR, ptr_var, new_dataref_ptr = copy_ssa_name (dataref_ptr, NULL);
incr_stmt = gimple_build_assign_with_ops (POINTER_PLUS_EXPR, new_dataref_ptr,
dataref_ptr, update); dataref_ptr, update);
new_dataref_ptr = make_ssa_name (ptr_var, incr_stmt);
gimple_assign_set_lhs (incr_stmt, new_dataref_ptr);
vect_finish_stmt_generation (stmt, incr_stmt, gsi); vect_finish_stmt_generation (stmt, incr_stmt, gsi);
/* Copy the points-to information if it exists. */ /* Copy the points-to information if it exists. */
...@@ -4356,12 +4354,11 @@ vect_setup_realignment (gimple stmt, gimple_stmt_iterator *gsi, ...@@ -4356,12 +4354,11 @@ vect_setup_realignment (gimple stmt, gimple_stmt_iterator *gsi,
ptr = vect_create_data_ref_ptr (stmt, vectype, loop_for_initial_load, ptr = vect_create_data_ref_ptr (stmt, vectype, loop_for_initial_load,
NULL_TREE, &init_addr, NULL, &inc, NULL_TREE, &init_addr, NULL, &inc,
true, &inv_p); true, &inv_p);
new_temp = copy_ssa_name (ptr, NULL);
new_stmt = gimple_build_assign_with_ops new_stmt = gimple_build_assign_with_ops
(BIT_AND_EXPR, NULL_TREE, ptr, (BIT_AND_EXPR, new_temp, ptr,
build_int_cst (TREE_TYPE (ptr), build_int_cst (TREE_TYPE (ptr),
-(HOST_WIDE_INT)TYPE_ALIGN_UNIT (vectype))); -(HOST_WIDE_INT)TYPE_ALIGN_UNIT (vectype)));
new_temp = make_ssa_name (SSA_NAME_VAR (ptr), new_stmt);
gimple_assign_set_lhs (new_stmt, new_temp);
new_bb = gsi_insert_on_edge_immediate (pe, new_stmt); new_bb = gsi_insert_on_edge_immediate (pe, new_stmt);
gcc_assert (!new_bb); gcc_assert (!new_bb);
data_ref data_ref
......
...@@ -511,14 +511,15 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop, ...@@ -511,14 +511,15 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
gsi_next (&gsi_orig), gsi_next (&gsi_update)) gsi_next (&gsi_orig), gsi_next (&gsi_update))
{ {
source_location loop_locus, guard_locus; source_location loop_locus, guard_locus;
tree new_res;
orig_phi = gsi_stmt (gsi_orig); orig_phi = gsi_stmt (gsi_orig);
update_phi = gsi_stmt (gsi_update); update_phi = gsi_stmt (gsi_update);
/** 1. Handle new-merge-point phis **/ /** 1. Handle new-merge-point phis **/
/* 1.1. Generate new phi node in NEW_MERGE_BB: */ /* 1.1. Generate new phi node in NEW_MERGE_BB: */
new_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (orig_phi)), new_res = copy_ssa_name (PHI_RESULT (orig_phi), NULL);
new_merge_bb); new_phi = create_phi_node (new_res, new_merge_bb);
/* 1.2. NEW_MERGE_BB has two incoming edges: GUARD_EDGE and the exit-edge /* 1.2. NEW_MERGE_BB has two incoming edges: GUARD_EDGE and the exit-edge
of LOOP. Set the two phi args in NEW_PHI for these edges: */ of LOOP. Set the two phi args in NEW_PHI for these edges: */
...@@ -547,8 +548,8 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop, ...@@ -547,8 +548,8 @@ slpeel_update_phi_nodes_for_guard1 (edge guard_edge, struct loop *loop,
continue; continue;
/* 2.1. Generate new phi node in NEW_EXIT_BB: */ /* 2.1. Generate new phi node in NEW_EXIT_BB: */
new_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (orig_phi)), new_res = copy_ssa_name (PHI_RESULT (orig_phi), NULL);
*new_exit_bb); new_phi = create_phi_node (new_res, *new_exit_bb);
/* 2.2. NEW_EXIT_BB has one incoming edge: the exit-edge of the loop. */ /* 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);
...@@ -636,6 +637,7 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop, ...@@ -636,6 +637,7 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
for (gsi = gsi_start_phis (update_bb); !gsi_end_p (gsi); gsi_next (&gsi)) for (gsi = gsi_start_phis (update_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{ {
tree new_res;
update_phi = gsi_stmt (gsi); update_phi = gsi_stmt (gsi);
orig_phi = update_phi; orig_phi = update_phi;
orig_def = PHI_ARG_DEF_FROM_EDGE (orig_phi, e); orig_def = PHI_ARG_DEF_FROM_EDGE (orig_phi, e);
...@@ -649,8 +651,8 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop, ...@@ -649,8 +651,8 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
/** 1. Handle new-merge-point phis **/ /** 1. Handle new-merge-point phis **/
/* 1.1. Generate new phi node in NEW_MERGE_BB: */ /* 1.1. Generate new phi node in NEW_MERGE_BB: */
new_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (orig_phi)), new_res = copy_ssa_name (PHI_RESULT (orig_phi), NULL);
new_merge_bb); new_phi = create_phi_node (new_res, new_merge_bb);
/* 1.2. NEW_MERGE_BB has two incoming edges: GUARD_EDGE and the exit-edge /* 1.2. NEW_MERGE_BB has two incoming edges: GUARD_EDGE and the exit-edge
of LOOP. Set the two PHI args in NEW_PHI for these edges: */ of LOOP. Set the two PHI args in NEW_PHI for these edges: */
...@@ -691,8 +693,8 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop, ...@@ -691,8 +693,8 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
/** 2. Handle loop-closed-ssa-form phis **/ /** 2. Handle loop-closed-ssa-form phis **/
/* 2.1. Generate new phi node in NEW_EXIT_BB: */ /* 2.1. Generate new phi node in NEW_EXIT_BB: */
new_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (orig_phi)), new_res = copy_ssa_name (PHI_RESULT (orig_phi), NULL);
*new_exit_bb); new_phi = create_phi_node (new_res, *new_exit_bb);
/* 2.2. NEW_EXIT_BB has one incoming edge: the exit-edge of the loop. */ /* 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);
...@@ -726,8 +728,8 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop, ...@@ -726,8 +728,8 @@ slpeel_update_phi_nodes_for_guard2 (edge guard_edge, struct loop *loop,
arg = guard_arg; arg = guard_arg;
/* 3.2. Generate new phi node in GUARD_BB: */ /* 3.2. Generate new phi node in GUARD_BB: */
new_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (orig_phi)), new_res = copy_ssa_name (PHI_RESULT (orig_phi), NULL);
guard_edge->src); new_phi = create_phi_node (new_res, guard_edge->src);
/* 3.3. GUARD_BB has one incoming edge: */ /* 3.3. GUARD_BB has one incoming edge: */
gcc_assert (EDGE_COUNT (guard_edge->src->preds) == 1); gcc_assert (EDGE_COUNT (guard_edge->src->preds) == 1);
...@@ -1182,13 +1184,11 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop, ...@@ -1182,13 +1184,11 @@ slpeel_tree_peel_loop_to_edge (struct loop *loop,
break; break;
if (gsi_end_p (gsi)) if (gsi_end_p (gsi))
{ {
gimple new_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (phi)), tree new_vop = copy_ssa_name (PHI_RESULT (phi), NULL);
exit_e->dest); gimple new_phi = create_phi_node (new_vop, exit_e->dest);
tree vop = PHI_ARG_DEF_FROM_EDGE (phi, EDGE_SUCC (loop->latch, 0)); tree vop = PHI_ARG_DEF_FROM_EDGE (phi, EDGE_SUCC (loop->latch, 0));
imm_use_iterator imm_iter; imm_use_iterator imm_iter;
gimple stmt; gimple stmt;
tree new_vop = make_ssa_name (SSA_NAME_VAR (PHI_RESULT (phi)),
new_phi);
use_operand_p use_p; 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);
...@@ -2535,9 +2535,10 @@ vect_loop_versioning (loop_vec_info loop_vinfo, ...@@ -2535,9 +2535,10 @@ vect_loop_versioning (loop_vec_info loop_vinfo,
for (gsi = gsi_start_phis (merge_bb); !gsi_end_p (gsi); gsi_next (&gsi)) for (gsi = gsi_start_phis (merge_bb); !gsi_end_p (gsi); gsi_next (&gsi))
{ {
tree new_res;
orig_phi = gsi_stmt (gsi); orig_phi = gsi_stmt (gsi);
new_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (orig_phi)), new_res = copy_ssa_name (PHI_RESULT (orig_phi), NULL);
new_exit_bb); new_phi = create_phi_node (new_res, new_exit_bb);
arg = PHI_ARG_DEF_FROM_EDGE (orig_phi, e); arg = PHI_ARG_DEF_FROM_EDGE (orig_phi, e);
add_phi_arg (new_phi, arg, new_exit_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));
......
...@@ -2270,7 +2270,7 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi, ...@@ -2270,7 +2270,7 @@ vect_is_simple_reduction_1 (loop_vec_info loop_info, gimple phi,
if (orig_code == MINUS_EXPR) if (orig_code == MINUS_EXPR)
{ {
tree rhs = gimple_assign_rhs2 (def_stmt); tree rhs = gimple_assign_rhs2 (def_stmt);
tree negrhs = make_ssa_name (SSA_NAME_VAR (rhs), NULL); tree negrhs = copy_ssa_name (rhs, NULL);
gimple negate_stmt = gimple_build_assign_with_ops (NEGATE_EXPR, negrhs, gimple negate_stmt = gimple_build_assign_with_ops (NEGATE_EXPR, negrhs,
rhs, NULL); rhs, NULL);
gimple_stmt_iterator gsi = gsi_for_stmt (def_stmt); gimple_stmt_iterator gsi = gsi_for_stmt (def_stmt);
...@@ -3700,7 +3700,8 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt, ...@@ -3700,7 +3700,8 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt,
{ {
for (j = 0; j < ncopies; j++) for (j = 0; j < ncopies; j++)
{ {
phi = create_phi_node (SSA_NAME_VAR (def), exit_bb); tree new_def = copy_ssa_name (def, NULL);
phi = create_phi_node (new_def, exit_bb);
set_vinfo_for_stmt (phi, new_stmt_vec_info (phi, loop_vinfo, NULL)); set_vinfo_for_stmt (phi, new_stmt_vec_info (phi, loop_vinfo, NULL));
if (j == 0) if (j == 0)
VEC_quick_push (gimple, new_phis, phi); VEC_quick_push (gimple, new_phis, phi);
...@@ -3724,8 +3725,8 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt, ...@@ -3724,8 +3725,8 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt,
inner_phis = VEC_alloc (gimple, heap, VEC_length (tree, vect_defs)); inner_phis = VEC_alloc (gimple, heap, VEC_length (tree, vect_defs));
FOR_EACH_VEC_ELT (gimple, new_phis, i, phi) FOR_EACH_VEC_ELT (gimple, new_phis, i, phi)
{ {
gimple outer_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (phi)), tree new_result = copy_ssa_name (PHI_RESULT (phi), NULL);
exit_bb); gimple outer_phi = create_phi_node (new_result, exit_bb);
SET_PHI_ARG_DEF (outer_phi, single_exit (loop)->dest_idx, SET_PHI_ARG_DEF (outer_phi, single_exit (loop)->dest_idx,
PHI_RESULT (phi)); PHI_RESULT (phi));
set_vinfo_for_stmt (outer_phi, new_stmt_vec_info (outer_phi, set_vinfo_for_stmt (outer_phi, new_stmt_vec_info (outer_phi,
...@@ -3736,8 +3737,8 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt, ...@@ -3736,8 +3737,8 @@ vect_create_epilog_for_reduction (VEC (tree, heap) *vect_defs, gimple stmt,
while (STMT_VINFO_RELATED_STMT (vinfo_for_stmt (phi))) while (STMT_VINFO_RELATED_STMT (vinfo_for_stmt (phi)))
{ {
phi = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (phi)); phi = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (phi));
outer_phi = create_phi_node (SSA_NAME_VAR (PHI_RESULT (phi)), new_result = copy_ssa_name (PHI_RESULT (phi), NULL);
exit_bb); outer_phi = create_phi_node (new_result, exit_bb);
SET_PHI_ARG_DEF (outer_phi, single_exit (loop)->dest_idx, SET_PHI_ARG_DEF (outer_phi, single_exit (loop)->dest_idx,
PHI_RESULT (phi)); PHI_RESULT (phi));
set_vinfo_for_stmt (outer_phi, new_stmt_vec_info (outer_phi, set_vinfo_for_stmt (outer_phi, new_stmt_vec_info (outer_phi,
......
...@@ -4668,15 +4668,13 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, ...@@ -4668,15 +4668,13 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
NULL_TREE, true, NULL_TREE, true,
GSI_SAME_STMT); GSI_SAME_STMT);
CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, newref); CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, newref);
newoff = SSA_NAME_VAR (running_off); newoff = copy_ssa_name (running_off, NULL);
if (POINTER_TYPE_P (TREE_TYPE (newoff))) if (POINTER_TYPE_P (TREE_TYPE (newoff)))
incr = gimple_build_assign_with_ops (POINTER_PLUS_EXPR, newoff, incr = gimple_build_assign_with_ops (POINTER_PLUS_EXPR, newoff,
running_off, stride_step); running_off, stride_step);
else else
incr = gimple_build_assign_with_ops (PLUS_EXPR, newoff, incr = gimple_build_assign_with_ops (PLUS_EXPR, newoff,
running_off, stride_step); running_off, stride_step);
newoff = make_ssa_name (newoff, incr);
gimple_assign_set_lhs (incr, newoff);
vect_finish_stmt_generation (stmt, incr, gsi); vect_finish_stmt_generation (stmt, incr, gsi);
running_off = newoff; running_off = newoff;
...@@ -4970,13 +4968,12 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, ...@@ -4970,13 +4968,12 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
dr_explicit_realign, dr_explicit_realign,
dataref_ptr, NULL); dataref_ptr, NULL);
ptr = copy_ssa_name (dataref_ptr, NULL);
new_stmt = gimple_build_assign_with_ops new_stmt = gimple_build_assign_with_ops
(BIT_AND_EXPR, NULL_TREE, dataref_ptr, (BIT_AND_EXPR, ptr, dataref_ptr,
build_int_cst build_int_cst
(TREE_TYPE (dataref_ptr), (TREE_TYPE (dataref_ptr),
-(HOST_WIDE_INT)TYPE_ALIGN_UNIT (vectype))); -(HOST_WIDE_INT)TYPE_ALIGN_UNIT (vectype)));
ptr = make_ssa_name (SSA_NAME_VAR (dataref_ptr), new_stmt);
gimple_assign_set_lhs (new_stmt, ptr);
vect_finish_stmt_generation (stmt, new_stmt, gsi); vect_finish_stmt_generation (stmt, new_stmt, gsi);
data_ref data_ref
= build2 (MEM_REF, vectype, ptr, = build2 (MEM_REF, vectype, ptr,
...@@ -5000,7 +4997,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, ...@@ -5000,7 +4997,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
build_int_cst build_int_cst
(TREE_TYPE (ptr), (TREE_TYPE (ptr),
-(HOST_WIDE_INT)TYPE_ALIGN_UNIT (vectype))); -(HOST_WIDE_INT)TYPE_ALIGN_UNIT (vectype)));
ptr = make_ssa_name (SSA_NAME_VAR (dataref_ptr), new_stmt); ptr = copy_ssa_name (dataref_ptr, new_stmt);
gimple_assign_set_lhs (new_stmt, ptr); gimple_assign_set_lhs (new_stmt, ptr);
vect_finish_stmt_generation (stmt, new_stmt, gsi); vect_finish_stmt_generation (stmt, new_stmt, gsi);
data_ref data_ref
...@@ -5010,14 +5007,12 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, ...@@ -5010,14 +5007,12 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt,
break; break;
} }
case dr_explicit_realign_optimized: case dr_explicit_realign_optimized:
new_temp = copy_ssa_name (dataref_ptr, NULL);
new_stmt = gimple_build_assign_with_ops new_stmt = gimple_build_assign_with_ops
(BIT_AND_EXPR, NULL_TREE, dataref_ptr, (BIT_AND_EXPR, new_temp, dataref_ptr,
build_int_cst build_int_cst
(TREE_TYPE (dataref_ptr), (TREE_TYPE (dataref_ptr),
-(HOST_WIDE_INT)TYPE_ALIGN_UNIT (vectype))); -(HOST_WIDE_INT)TYPE_ALIGN_UNIT (vectype)));
new_temp = make_ssa_name (SSA_NAME_VAR (dataref_ptr),
new_stmt);
gimple_assign_set_lhs (new_stmt, new_temp);
vect_finish_stmt_generation (stmt, new_stmt, gsi); vect_finish_stmt_generation (stmt, new_stmt, gsi);
data_ref data_ref
= build2 (MEM_REF, vectype, new_temp, = build2 (MEM_REF, vectype, new_temp,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment