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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140562
138bc75d-0d04-0410-961f-
82ee72b054a4
+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>
* 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>
* gcc.target/mips/octeon-baddu-1.c: New test.
--- /dev/null
+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;
+ }
+}
return a.u.k;
}
-/* { dg-final { scan-tree-dump-times "Inserted pretmp" 1 "fre" { xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump-times "Replaced a.u.f with pretmp" 3 "fre" { xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump-times "Replaced a.u.k with j" 1 "fre" { xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump "= VIEW_CONVERT_EXPR<float>\\\(j_" "fre" { xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump "return j" "optimized" { 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" } } */
+/* { 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" } } */
+/* { dg-final { scan-tree-dump "return j" "optimized" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */
}
}
-/* { dg-final { scan-tree-dump-times "Replaced u.f with pretmp" 2 "fre" { xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump-times "Inserted 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" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
}
}
-/* { dg-final { scan-tree-dump-times "Eliminated: 1" 2 "fre" { xfail *-*-* } } } */
-/* { dg-final { scan-tree-dump-times "Insertions: 1" 2 "fre" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "Eliminated: 1" 2 "fre" } } */
+/* { dg-final { scan-tree-dump-times "Insertions: 1" 2 "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
}
/* If it's still NULL, it must be a complex expression, so generate
- it recursively. */
- if (genop == NULL)
+ it recursively. Not so for FRE though. */
+ if (genop == NULL
+ && !in_fre)
{
bitmap_set_t exprset;
unsigned int lookfor = get_expr_value_id (expr);
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:
}
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. */
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;