Commit 2262707f by Richard Guenther Committed by Richard Biener

tree-ssa-sccvn.c (visit_unary_op): Rename to ...

2010-11-16  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-sccvn.c (visit_unary_op): Rename to ...
	(visit_nary_op): ... this.
	(visit_binary_op): Remove.
	(visit_use): Adjust and handle GIMPLE_TERNARY_RHS.

	* gcc.dg/tree-ssa/ssa-fre-30.c: New testcase.

From-SVN: r166795
parent 05613877
2010-11-16 Richard Guenther <rguenther@suse.de> 2010-11-16 Richard Guenther <rguenther@suse.de>
* tree-ssa-sccvn.c (visit_unary_op): Rename to ...
(visit_nary_op): ... this.
(visit_binary_op): Remove.
(visit_use): Adjust and handle GIMPLE_TERNARY_RHS.
2010-11-16 Richard Guenther <rguenther@suse.de>
PR middle-end/45172 PR middle-end/45172
* tree-eh.c (cleanup_empty_eh_unsplit): Avoid creating duplicate * tree-eh.c (cleanup_empty_eh_unsplit): Avoid creating duplicate
edges. edges.
2010-11-16 Richard Guenther <rguenther@suse.de> 2010-11-16 Richard Guenther <rguenther@suse.de>
* gcc.dg/tree-ssa/ssa-fre-30.c: New testcase.
2010-11-16 Richard Guenther <rguenther@suse.de>
PR middle-end/45172 PR middle-end/45172
* gfortran.dg/gomp/pr45172.f90: New testcase. * gfortran.dg/gomp/pr45172.f90: New testcase.
......
/* { dg-do compile } */
/* { dg-options "-O -ffinite-math-only -fdump-tree-optimized" } */
float foo(float x, float y, float z)
{
float a = __builtin_fmaf (x, y, z);
float b = __builtin_fmaf (x, y, z);
return a - b;
}
/* { dg-final { scan-tree-dump "return 0" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
...@@ -2167,41 +2167,17 @@ visit_copy (tree lhs, tree rhs) ...@@ -2167,41 +2167,17 @@ visit_copy (tree lhs, tree rhs)
return set_ssa_val_to (lhs, rhs); return set_ssa_val_to (lhs, rhs);
} }
/* Visit a unary operator RHS, value number it, and return true if the /* Visit a nary operator RHS, value number it, and return true if the
value number of LHS has changed as a result. */ value number of LHS has changed as a result. */
static bool static bool
visit_unary_op (tree lhs, gimple stmt) visit_nary_op (tree lhs, gimple stmt)
{ {
bool changed = false; bool changed = false;
tree result = vn_nary_op_lookup_stmt (stmt, NULL); tree result = vn_nary_op_lookup_stmt (stmt, NULL);
if (result) if (result)
{ changed = set_ssa_val_to (lhs, result);
changed = set_ssa_val_to (lhs, result);
}
else
{
changed = set_ssa_val_to (lhs, lhs);
vn_nary_op_insert_stmt (stmt, lhs);
}
return changed;
}
/* Visit a binary operator RHS, value number it, and return true if the
value number of LHS has changed as a result. */
static bool
visit_binary_op (tree lhs, gimple stmt)
{
bool changed = false;
tree result = vn_nary_op_lookup_stmt (stmt, NULL);
if (result)
{
changed = set_ssa_val_to (lhs, result);
}
else else
{ {
changed = set_ssa_val_to (lhs, lhs); changed = set_ssa_val_to (lhs, lhs);
...@@ -2909,10 +2885,9 @@ visit_use (tree use) ...@@ -2909,10 +2885,9 @@ visit_use (tree use)
switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt))) switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt)))
{ {
case GIMPLE_UNARY_RHS: case GIMPLE_UNARY_RHS:
changed = visit_unary_op (lhs, stmt);
break;
case GIMPLE_BINARY_RHS: case GIMPLE_BINARY_RHS:
changed = visit_binary_op (lhs, stmt); case GIMPLE_TERNARY_RHS:
changed = visit_nary_op (lhs, stmt);
break; break;
case GIMPLE_SINGLE_RHS: case GIMPLE_SINGLE_RHS:
switch (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt))) switch (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)))
...@@ -2921,10 +2896,10 @@ visit_use (tree use) ...@@ -2921,10 +2896,10 @@ visit_use (tree use)
/* VOP-less references can go through unary case. */ /* VOP-less references can go through unary case. */
if ((gimple_assign_rhs_code (stmt) == REALPART_EXPR if ((gimple_assign_rhs_code (stmt) == REALPART_EXPR
|| gimple_assign_rhs_code (stmt) == IMAGPART_EXPR || gimple_assign_rhs_code (stmt) == IMAGPART_EXPR
|| gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR ) || gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR)
&& TREE_CODE (TREE_OPERAND (gimple_assign_rhs1 (stmt), 0)) == SSA_NAME) && TREE_CODE (TREE_OPERAND (gimple_assign_rhs1 (stmt), 0)) == SSA_NAME)
{ {
changed = visit_unary_op (lhs, stmt); changed = visit_nary_op (lhs, stmt);
break; break;
} }
/* Fallthrough. */ /* Fallthrough. */
...@@ -2935,7 +2910,7 @@ visit_use (tree use) ...@@ -2935,7 +2910,7 @@ visit_use (tree use)
case tcc_expression: case tcc_expression:
if (gimple_assign_rhs_code (stmt) == ADDR_EXPR) if (gimple_assign_rhs_code (stmt) == ADDR_EXPR)
{ {
changed = visit_unary_op (lhs, stmt); changed = visit_nary_op (lhs, stmt);
break; break;
} }
/* Fallthrough. */ /* Fallthrough. */
......
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