Commit 2724573f by Richard Biener Committed by Richard Biener

tree-cfgcleanup.c (remove_forwarder_block): Unshare propagated PHI argument.

2013-01-14  Richard Biener  <rguenther@suse.de>

	* tree-cfgcleanup.c (remove_forwarder_block): Unshare propagated
	PHI argument.
	* graphite-sese-to-poly.c (insert_out_of_ssa_copy): Properly
	unshare reference.
	(insert_out_of_ssa_copy_on_edge): Likewise.
	(rewrite_close_phi_out_of_ssa): Likewise.
	* tree-ssa.c (insert_debug_temp_for_var_def): Properly unshare
	debug expressions.
	* tree-ssa-pre.c (insert_into_preds_of_block): Properly unshare
	propagated constants.
	* tree-cfg.c (tree_node_can_be_shared): Handled component-refs
	can not be shared.

From-SVN: r195144
parent 9a0bbab6
2013-01-14 Richard Biener <rguenther@suse.de>
* tree-cfgcleanup.c (remove_forwarder_block): Unshare propagated
PHI argument.
* graphite-sese-to-poly.c (insert_out_of_ssa_copy): Properly
unshare reference.
(insert_out_of_ssa_copy_on_edge): Likewise.
(rewrite_close_phi_out_of_ssa): Likewise.
* tree-ssa.c (insert_debug_temp_for_var_def): Properly unshare
debug expressions.
* tree-ssa-pre.c (insert_into_preds_of_block): Properly unshare
propagated constants.
* tree-cfg.c (tree_node_can_be_shared): Handled component-refs
can not be shared.
2013-01-14 Georg-Johann Lay <avr@gjlay.de> 2013-01-14 Georg-Johann Lay <avr@gjlay.de>
* config/avr/avr-modes.def: Add GPL copyright notice. * config/avr/avr-modes.def: Add GPL copyright notice.
......
...@@ -2020,7 +2020,7 @@ insert_out_of_ssa_copy (scop_p scop, tree res, tree expr, gimple after_stmt) ...@@ -2020,7 +2020,7 @@ insert_out_of_ssa_copy (scop_p scop, tree res, tree expr, gimple after_stmt)
gimple_seq stmts; gimple_seq stmts;
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE); tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE);
gimple stmt = gimple_build_assign (res, var); gimple stmt = gimple_build_assign (unshare_expr (res), var);
vec<gimple> x; vec<gimple> x;
x.create (3); x.create (3);
...@@ -2076,7 +2076,7 @@ insert_out_of_ssa_copy_on_edge (scop_p scop, edge e, tree res, tree expr) ...@@ -2076,7 +2076,7 @@ insert_out_of_ssa_copy_on_edge (scop_p scop, edge e, tree res, tree expr)
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
gimple_seq stmts = NULL; gimple_seq stmts = NULL;
tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE); tree var = force_gimple_operand (expr, &stmts, true, NULL_TREE);
gimple stmt = gimple_build_assign (res, var); gimple stmt = gimple_build_assign (unshare_expr (res), var);
basic_block bb; basic_block bb;
vec<gimple> x; vec<gimple> x;
x.create (3); x.create (3);
...@@ -2232,7 +2232,7 @@ rewrite_close_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi) ...@@ -2232,7 +2232,7 @@ rewrite_close_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi)
{ {
tree zero_dim_array = create_zero_dim_array (res, "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, unshare_expr (zero_dim_array));
if (TREE_CODE (arg) == SSA_NAME) if (TREE_CODE (arg) == SSA_NAME)
insert_out_of_ssa_copy (scop, zero_dim_array, arg, insert_out_of_ssa_copy (scop, zero_dim_array, arg,
...@@ -2258,10 +2258,8 @@ rewrite_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi) ...@@ -2258,10 +2258,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;
tree zero_dim_array = create_zero_dim_array (res, "phi_out_of_ssa"); tree zero_dim_array = create_zero_dim_array (res, "phi_out_of_ssa");
gimple stmt; gimple stmt;
gimple_seq stmts;
for (i = 0; i < gimple_phi_num_args (phi); i++) for (i = 0; i < gimple_phi_num_args (phi); i++)
{ {
...@@ -2278,13 +2276,10 @@ rewrite_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi) ...@@ -2278,13 +2276,10 @@ rewrite_phi_out_of_ssa (scop_p scop, gimple_stmt_iterator *psi)
insert_out_of_ssa_copy_on_edge (scop, e, zero_dim_array, arg); insert_out_of_ssa_copy_on_edge (scop, e, zero_dim_array, arg);
} }
var = force_gimple_operand (zero_dim_array, &stmts, true, NULL_TREE); stmt = gimple_build_assign (res, unshare_expr (zero_dim_array));
stmt = gimple_build_assign (res, var);
remove_phi_node (psi, false); remove_phi_node (psi, false);
SSA_NAME_DEF_STMT (res) = stmt; SSA_NAME_DEF_STMT (res) = stmt;
insert_stmts (scop, stmt, NULL, gsi_after_labels (bb));
insert_stmts (scop, stmt, stmts, gsi_after_labels (bb));
} }
/* Rewrite the degenerate phi node at position PSI from the degenerate /* Rewrite the degenerate phi node at position PSI from the degenerate
......
...@@ -4449,13 +4449,6 @@ tree_node_can_be_shared (tree t) ...@@ -4449,13 +4449,6 @@ tree_node_can_be_shared (tree t)
if (TREE_CODE (t) == CASE_LABEL_EXPR) if (TREE_CODE (t) == CASE_LABEL_EXPR)
return true; return true;
while (((TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
&& is_gimple_min_invariant (TREE_OPERAND (t, 1)))
|| TREE_CODE (t) == COMPONENT_REF
|| TREE_CODE (t) == REALPART_EXPR
|| TREE_CODE (t) == IMAGPART_EXPR)
t = TREE_OPERAND (t, 0);
if (DECL_P (t)) if (DECL_P (t))
return true; return true;
......
...@@ -412,7 +412,8 @@ remove_forwarder_block (basic_block bb) ...@@ -412,7 +412,8 @@ remove_forwarder_block (basic_block bb)
{ {
gimple phi = gsi_stmt (gsi); gimple phi = gsi_stmt (gsi);
source_location l = gimple_phi_arg_location_from_edge (phi, succ); 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 def = gimple_phi_arg_def (phi, succ->dest_idx);
add_phi_arg (phi, unshare_expr (def), s, l);
} }
} }
} }
......
...@@ -3246,7 +3246,8 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum, ...@@ -3246,7 +3246,8 @@ insert_into_preds_of_block (basic_block block, unsigned int exprnum,
gcc_assert (get_expr_type (ae) == type gcc_assert (get_expr_type (ae) == type
|| useless_type_conversion_p (type, get_expr_type (ae))); || useless_type_conversion_p (type, get_expr_type (ae)));
if (ae->kind == CONSTANT) if (ae->kind == CONSTANT)
add_phi_arg (phi, PRE_EXPR_CONSTANT (ae), pred, UNKNOWN_LOCATION); add_phi_arg (phi, unshare_expr (PRE_EXPR_CONSTANT (ae)),
pred, UNKNOWN_LOCATION);
else else
add_phi_arg (phi, PRE_EXPR_NAME (ae), pred, UNKNOWN_LOCATION); add_phi_arg (phi, PRE_EXPR_NAME (ae), pred, UNKNOWN_LOCATION);
} }
......
...@@ -427,7 +427,7 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var) ...@@ -427,7 +427,7 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var)
&& (!gimple_assign_single_p (def_stmt) && (!gimple_assign_single_p (def_stmt)
|| is_gimple_min_invariant (value))) || is_gimple_min_invariant (value)))
|| is_gimple_reg (value)) || is_gimple_reg (value))
value = unshare_expr (value); ;
else else
{ {
gimple def_temp; gimple def_temp;
...@@ -469,7 +469,7 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var) ...@@ -469,7 +469,7 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var)
that was unshared when we found it had a single debug that was unshared when we found it had a single debug
use, or a DEBUG_EXPR_DECL, that can be safely use, or a DEBUG_EXPR_DECL, that can be safely
shared. */ shared. */
SET_USE (use_p, value); SET_USE (use_p, unshare_expr (value));
/* If we didn't replace uses with a debug decl fold the /* If we didn't replace uses with a debug decl fold the
resulting expression. Otherwise we end up with invalid IL. */ resulting expression. Otherwise we end up with invalid IL. */
if (TREE_CODE (value) != DEBUG_EXPR_DECL) if (TREE_CODE (value) != DEBUG_EXPR_DECL)
......
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