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
This commit is contained in:
parent
05613877bd
commit
2262707f73
4 changed files with 31 additions and 33 deletions
|
@ -1,3 +1,10 @@
|
|||
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
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
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
|
||||
|
|
12
gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-30.c
Normal file
12
gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-30.c
Normal file
|
@ -0,0 +1,12 @@
|
|||
/* { 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)
|
|||
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. */
|
||||
|
||||
static bool
|
||||
visit_unary_op (tree lhs, gimple stmt)
|
||||
visit_nary_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
|
||||
{
|
||||
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);
|
||||
}
|
||||
changed = set_ssa_val_to (lhs, result);
|
||||
else
|
||||
{
|
||||
changed = set_ssa_val_to (lhs, lhs);
|
||||
|
@ -2909,10 +2885,9 @@ visit_use (tree use)
|
|||
switch (get_gimple_rhs_class (gimple_assign_rhs_code (stmt)))
|
||||
{
|
||||
case GIMPLE_UNARY_RHS:
|
||||
changed = visit_unary_op (lhs, stmt);
|
||||
break;
|
||||
case GIMPLE_BINARY_RHS:
|
||||
changed = visit_binary_op (lhs, stmt);
|
||||
case GIMPLE_TERNARY_RHS:
|
||||
changed = visit_nary_op (lhs, stmt);
|
||||
break;
|
||||
case GIMPLE_SINGLE_RHS:
|
||||
switch (TREE_CODE_CLASS (gimple_assign_rhs_code (stmt)))
|
||||
|
@ -2921,10 +2896,10 @@ visit_use (tree use)
|
|||
/* VOP-less references can go through unary case. */
|
||||
if ((gimple_assign_rhs_code (stmt) == REALPART_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)
|
||||
{
|
||||
changed = visit_unary_op (lhs, stmt);
|
||||
changed = visit_nary_op (lhs, stmt);
|
||||
break;
|
||||
}
|
||||
/* Fallthrough. */
|
||||
|
@ -2935,7 +2910,7 @@ visit_use (tree use)
|
|||
case tcc_expression:
|
||||
if (gimple_assign_rhs_code (stmt) == ADDR_EXPR)
|
||||
{
|
||||
changed = visit_unary_op (lhs, stmt);
|
||||
changed = visit_nary_op (lhs, stmt);
|
||||
break;
|
||||
}
|
||||
/* Fallthrough. */
|
||||
|
|
Loading…
Add table
Reference in a new issue