Commit e7cb8957 by Sebastian Pop Committed by Sebastian Pop

Don't generate COND_EXPRs for degenerate_phi_result.

2010-05-28  Sebastian Pop  <sebastian.pop@amd.com>

	* tree-if-conv.c (replace_phi_with_cond_gimple_assign_stmt): Don't
	generate COND_EXPRs for degenerate_phi_result.

From-SVN: r159991
parent d10e857e
2010-05-28 Sebastian Pop <sebastian.pop@amd.com> 2010-05-28 Sebastian Pop <sebastian.pop@amd.com>
* tree-if-conv.c (replace_phi_with_cond_gimple_assign_stmt): Don't
generate COND_EXPRs for degenerate_phi_result.
2010-05-28 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/44293 PR middle-end/44293
* tree-if-conv.c (if_convertible_loop_p): Check the * tree-if-conv.c (if_convertible_loop_p): Check the
if-convertibility of phi nodes in non predicated BBs. if-convertibility of phi nodes in non predicated BBs.
......
...@@ -864,31 +864,37 @@ replace_phi_with_cond_gimple_assign_stmt (gimple phi, tree cond, ...@@ -864,31 +864,37 @@ replace_phi_with_cond_gimple_assign_stmt (gimple phi, tree cond,
gimple new_stmt; gimple new_stmt;
basic_block bb; basic_block bb;
tree rhs; tree rhs;
tree arg_0, arg_1; tree arg;
gcc_assert (gimple_code (phi) == GIMPLE_PHI gcc_assert (gimple_code (phi) == GIMPLE_PHI
&& gimple_phi_num_args (phi) == 2); && gimple_phi_num_args (phi) == 2);
bb = gimple_bb (phi); bb = gimple_bb (phi);
/* Use condition that is not TRUTH_NOT_EXPR in conditional modify expr. */ arg = degenerate_phi_result (phi);
if (EDGE_PRED (bb, 1)->src == true_bb) if (arg)
{ rhs = arg;
arg_0 = gimple_phi_arg_def (phi, 1);
arg_1 = gimple_phi_arg_def (phi, 0);
}
else else
{ {
arg_0 = gimple_phi_arg_def (phi, 0); tree arg_0, arg_1;
arg_1 = gimple_phi_arg_def (phi, 1); /* Use condition that is not TRUTH_NOT_EXPR in conditional modify expr. */
} if (EDGE_PRED (bb, 1)->src == true_bb)
{
arg_0 = gimple_phi_arg_def (phi, 1);
arg_1 = gimple_phi_arg_def (phi, 0);
}
else
{
arg_0 = gimple_phi_arg_def (phi, 0);
arg_1 = gimple_phi_arg_def (phi, 1);
}
/* Build new RHS using selected condition and arguments. */ /* Build new RHS using selected condition and arguments. */
rhs = build3 (COND_EXPR, TREE_TYPE (PHI_RESULT (phi)), rhs = build3 (COND_EXPR, TREE_TYPE (PHI_RESULT (phi)),
unshare_expr (cond), unshare_expr (arg_0), unshare_expr (cond), arg_0, arg_1);
unshare_expr (arg_1)); }
new_stmt = gimple_build_assign (unshare_expr (PHI_RESULT (phi)), rhs); new_stmt = gimple_build_assign (PHI_RESULT (phi), rhs);
SSA_NAME_DEF_STMT (gimple_phi_result (phi)) = new_stmt; SSA_NAME_DEF_STMT (gimple_phi_result (phi)) = new_stmt;
gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT); gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT);
update_stmt (new_stmt); update_stmt (new_stmt);
......
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