diff options
author | Richard Guenther <rguenther@suse.de> | 2008-09-22 19:15:43 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-09-22 19:15:43 +0000 |
commit | ecb4e37b73d7649a447fe63f33dc20826fce0bb6 (patch) | |
tree | 011ef08c0c1e906fc44e085fd10886019e133ce7 /gcc/tree-ssa-sccvn.c | |
parent | 880f8ea3bd9ca8e4d1acf5083760da66b05fea59 (diff) | |
download | gcc-ecb4e37b73d7649a447fe63f33dc20826fce0bb6.zip gcc-ecb4e37b73d7649a447fe63f33dc20826fce0bb6.tar.gz gcc-ecb4e37b73d7649a447fe63f33dc20826fce0bb6.tar.bz2 |
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
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index dbffff5..290b308 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -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 is always a spurious difference. */ temp.type = NULL_TREE; -#if FIXME /* If this is a reference to a union member, record the union member size as operand. Do so only if we are doing expression insertion (during FRE), as PRE currently gets confused with this. */ if (may_insert + && TREE_OPERAND (ref, 2) == NULL_TREE && TREE_CODE (DECL_CONTEXT (TREE_OPERAND (ref, 1))) == UNION_TYPE && integer_zerop (DECL_FIELD_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))); else -#endif - /* Record field as operand. */ - temp.op0 = TREE_OPERAND (ref, 1); - temp.op1 = TREE_OPERAND (ref, 2); + { + /* Record field as operand. */ + temp.op0 = TREE_OPERAND (ref, 1); + temp.op1 = TREE_OPERAND (ref, 2); + } break; case ARRAY_RANGE_REF: case ARRAY_REF: @@ -1612,7 +1613,7 @@ defs_to_varying (gimple stmt) } 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 changed. */ @@ -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 is already available. */ tree val = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (op), result); - if (stmt - && !is_gimple_min_invariant (val) - && TREE_CODE (val) != SSA_NAME) + if ((CONVERT_EXPR_P (val) + || TREE_CODE (val) == VIEW_CONVERT_EXPR) + && TREE_CODE (TREE_OPERAND (val, 0)) == SSA_NAME) { - tree tem = try_to_simplify (stmt); - if (tem) + tree tem = valueize_expr (vn_get_expr_for (TREE_OPERAND (val, 0))); + if ((CONVERT_EXPR_P (tem) + || TREE_CODE (tem) == VIEW_CONVERT_EXPR) + && (tem = fold_unary (TREE_CODE (val), TREE_TYPE (val), tem))) val = tem; } result = val; |