Commit ecb4e37b by Richard Guenther Committed by Richard Biener

re PR tree-optimization/37145 (XFAILs from PRE rewrite, SCCVN union optimization disabled)

2008-09-22  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/37145
	* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Re-enable
	value-numbering union accesses with their offset and size only.
	(visit_reference_op_load): Fix simplification of inserted conversions.
	* tree-ssa-pre.c (find_or_generate_expression): Do not
	recursively generate expressions if running FRE.

	* gcc.c-torture/compile/20080922-1.c: New testcase.
	* gcc.dg/tree-ssa/ssa-fre-7.c: Remove XFAIL.
	* gcc.dg/tree-ssa/ssa-fre-8.c: Likewise.
	* gcc.dg/tree-ssa/ssa-fre-9.c: Likewise.

From-SVN: r140562
parent 880f8ea3
2008-09-22 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37145
* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Re-enable
value-numbering union accesses with their offset and size only.
(visit_reference_op_load): Fix simplification of inserted conversions.
* tree-ssa-pre.c (find_or_generate_expression): Do not
recursively generate expressions if running FRE.
2008-09-22 Adam Nemet <anemet@caviumnetworks.com> 2008-09-22 Adam Nemet <anemet@caviumnetworks.com>
* config/mips/mips.h (ISA_HAS_BADDU): New macro. * config/mips/mips.h (ISA_HAS_BADDU): New macro.
......
2008-09-22 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37145
* gcc.c-torture/compile/20080922-1.c: New testcase.
* gcc.dg/tree-ssa/ssa-fre-7.c: Remove XFAIL.
* gcc.dg/tree-ssa/ssa-fre-8.c: Likewise.
* gcc.dg/tree-ssa/ssa-fre-9.c: Likewise.
2008-09-22 Adam Nemet <anemet@caviumnetworks.com> 2008-09-22 Adam Nemet <anemet@caviumnetworks.com>
* gcc.target/mips/octeon-baddu-1.c: New test. * gcc.target/mips/octeon-baddu-1.c: New test.
......
typedef struct rtx_def *rtx;
typedef struct rtvec_def *rtvec;
enum rtx_code { PARALLEL, SET };
union rtunion_def {
rtx rt_rtx;
rtvec rt_rtvec;
};
typedef union rtunion_def rtunion;
struct rtx_def {
rtunion fld;
};
struct rtvec_def {
int num_elem;
};
extern rtx operand;
rtx peephole2_insns (rtx x0, enum rtx_code code)
{
switch (code)
{
case SET:
operand = (((x0)->fld).rt_rtx);
return operand;
case PARALLEL:
if ((((((x0)->fld).rt_rtvec))->num_elem) == 2)
return 0;
break;
}
}
...@@ -29,10 +29,10 @@ intflt foo(intflt j) ...@@ -29,10 +29,10 @@ intflt foo(intflt j)
return a.u.k; return a.u.k;
} }
/* { dg-final { scan-tree-dump-times "Inserted pretmp" 1 "fre" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump-times "Inserted pretmp" 1 "fre" } } */
/* { dg-final { scan-tree-dump-times "Replaced a.u.f with pretmp" 3 "fre" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump-times "Replaced a.u.f with pretmp" 3 "fre" } } */
/* { dg-final { scan-tree-dump-times "Replaced a.u.k with j" 1 "fre" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump-times "Replaced a.u.k with j" 1 "fre" } } */
/* { dg-final { scan-tree-dump "= VIEW_CONVERT_EXPR<float>\\\(j_" "fre" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump "= VIEW_CONVERT_EXPR<float>\\\(j_" "fre" } } */
/* { dg-final { scan-tree-dump "return j" "optimized" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump "return j" "optimized" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */ /* { dg-final { cleanup-tree-dump "fre" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */ /* { dg-final { cleanup-tree-dump "optimized" } } */
...@@ -28,6 +28,6 @@ intflt foo(int i, int b) ...@@ -28,6 +28,6 @@ intflt foo(int i, int b)
} }
} }
/* { dg-final { scan-tree-dump-times "Replaced u.f with pretmp" 2 "fre" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump-times "Replaced u.f with pretmp" 2 "fre" } } */
/* { dg-final { scan-tree-dump-times "Inserted pretmp" 2 "fre" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump-times "Inserted pretmp" 2 "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */ /* { dg-final { cleanup-tree-dump "fre" } } */
...@@ -23,6 +23,6 @@ void __frame_state_for1 (volatile char *state_in) ...@@ -23,6 +23,6 @@ void __frame_state_for1 (volatile char *state_in)
} }
} }
/* { dg-final { scan-tree-dump-times "Eliminated: 1" 2 "fre" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump-times "Eliminated: 1" 2 "fre" } } */
/* { dg-final { scan-tree-dump-times "Insertions: 1" 2 "fre" { xfail *-*-* } } } */ /* { dg-final { scan-tree-dump-times "Insertions: 1" 2 "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */ /* { dg-final { cleanup-tree-dump "fre" } } */
...@@ -2730,8 +2730,9 @@ find_or_generate_expression (basic_block block, pre_expr expr, ...@@ -2730,8 +2730,9 @@ find_or_generate_expression (basic_block block, pre_expr expr,
} }
/* If it's still NULL, it must be a complex expression, so generate /* If it's still NULL, it must be a complex expression, so generate
it recursively. */ it recursively. Not so for FRE though. */
if (genop == NULL) if (genop == NULL
&& !in_fre)
{ {
bitmap_set_t exprset; bitmap_set_t exprset;
unsigned int lookfor = get_expr_value_id (expr); unsigned int lookfor = get_expr_value_id (expr);
......
...@@ -612,21 +612,22 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result) ...@@ -612,21 +612,22 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
a matching type is not necessary and a mismatching type a matching type is not necessary and a mismatching type
is always a spurious difference. */ is always a spurious difference. */
temp.type = NULL_TREE; temp.type = NULL_TREE;
#if FIXME
/* If this is a reference to a union member, record the union /* If this is a reference to a union member, record the union
member size as operand. Do so only if we are doing member size as operand. Do so only if we are doing
expression insertion (during FRE), as PRE currently gets expression insertion (during FRE), as PRE currently gets
confused with this. */ confused with this. */
if (may_insert if (may_insert
&& TREE_OPERAND (ref, 2) == NULL_TREE
&& TREE_CODE (DECL_CONTEXT (TREE_OPERAND (ref, 1))) == UNION_TYPE && TREE_CODE (DECL_CONTEXT (TREE_OPERAND (ref, 1))) == UNION_TYPE
&& integer_zerop (DECL_FIELD_OFFSET (TREE_OPERAND (ref, 1))) && integer_zerop (DECL_FIELD_OFFSET (TREE_OPERAND (ref, 1)))
&& integer_zerop (DECL_FIELD_BIT_OFFSET (TREE_OPERAND (ref, 1)))) && integer_zerop (DECL_FIELD_BIT_OFFSET (TREE_OPERAND (ref, 1))))
temp.op0 = TYPE_SIZE (TREE_TYPE (TREE_OPERAND (ref, 1))); temp.op0 = TYPE_SIZE (TREE_TYPE (TREE_OPERAND (ref, 1)));
else else
#endif {
/* Record field as operand. */ /* Record field as operand. */
temp.op0 = TREE_OPERAND (ref, 1); temp.op0 = TREE_OPERAND (ref, 1);
temp.op1 = TREE_OPERAND (ref, 2); temp.op1 = TREE_OPERAND (ref, 2);
}
break; break;
case ARRAY_RANGE_REF: case ARRAY_RANGE_REF:
case ARRAY_REF: case ARRAY_REF:
...@@ -1612,7 +1613,7 @@ defs_to_varying (gimple stmt) ...@@ -1612,7 +1613,7 @@ defs_to_varying (gimple stmt)
} }
static bool expr_has_constants (tree expr); static bool expr_has_constants (tree expr);
static tree try_to_simplify (gimple stmt); static tree valueize_expr (tree expr);
/* Visit a copy between LHS and RHS, return true if the value number /* Visit a copy between LHS and RHS, return true if the value number
changed. */ changed. */
...@@ -1742,12 +1743,14 @@ visit_reference_op_load (tree lhs, tree op, gimple stmt) ...@@ -1742,12 +1743,14 @@ visit_reference_op_load (tree lhs, tree op, gimple stmt)
So first simplify and lookup this expression to see if it So first simplify and lookup this expression to see if it
is already available. */ is already available. */
tree val = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (op), result); tree val = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (op), result);
if (stmt if ((CONVERT_EXPR_P (val)
&& !is_gimple_min_invariant (val) || TREE_CODE (val) == VIEW_CONVERT_EXPR)
&& TREE_CODE (val) != SSA_NAME) && TREE_CODE (TREE_OPERAND (val, 0)) == SSA_NAME)
{ {
tree tem = try_to_simplify (stmt); tree tem = valueize_expr (vn_get_expr_for (TREE_OPERAND (val, 0)));
if (tem) if ((CONVERT_EXPR_P (tem)
|| TREE_CODE (tem) == VIEW_CONVERT_EXPR)
&& (tem = fold_unary (TREE_CODE (val), TREE_TYPE (val), tem)))
val = tem; val = tem;
} }
result = val; result = val;
......
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