Commit ba2e1892 by Richard Guenther Committed by Richard Biener

tree-vn.c (expressions_equal_p): Do not check type equality or compatibility…

tree-vn.c (expressions_equal_p): Do not check type equality or compatibility before calling operand_equal_p.

2008-04-17  Richard Guenther  <rguenther@suse.de>

	* tree-vn.c (expressions_equal_p): Do not check type
	equality or compatibility before calling operand_equal_p.
	* fold-const.c (operand_equal_p): Check equivalence of
	integer constants before bailing out due to signedness or
	precision differences.
	* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Ignore
	spurious differences in type qualification.  Ignore types
	for COMPONENT_REFs at all.

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

From-SVN: r134384
parent 499928c1
2008-04-17 Richard Guenther <rguenther@suse.de>
* tree-vn.c (expressions_equal_p): Do not check type
equality or compatibility before calling operand_equal_p.
* fold-const.c (operand_equal_p): Check equivalence of
integer constants before bailing out due to signedness or
precision differences.
* tree-ssa-sccvn.c (copy_reference_ops_from_ref): Ignore
spurious differences in type qualification. Ignore types
for COMPONENT_REFs at all.
2008-04-17 Christian Bruel <christian.bruel@st.com> 2008-04-17 Christian Bruel <christian.bruel@st.com>
* config/sh/sh.c (expand_cbranchdi4): Use original operands for * config/sh/sh.c (expand_cbranchdi4): Use original operands for
......
...@@ -3026,6 +3026,11 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags) ...@@ -3026,6 +3026,11 @@ operand_equal_p (const_tree arg0, const_tree arg1, unsigned int flags)
if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) == ERROR_MARK) if (TREE_CODE (arg0) == ERROR_MARK || TREE_CODE (arg1) == ERROR_MARK)
return 0; return 0;
/* Check equality of integer constants before bailing out due to
precision differences. */
if (TREE_CODE (arg0) == INTEGER_CST && TREE_CODE (arg1) == INTEGER_CST)
return tree_int_cst_equal (arg0, arg1);
/* If both types don't have the same signedness, then we can't consider /* If both types don't have the same signedness, then we can't consider
them equal. We must check this before the STRIP_NOPS calls them equal. We must check this before the STRIP_NOPS calls
because they may change the signedness of the arguments. */ because they may change the signedness of the arguments. */
......
2008-04-17 Richard Guenther <rguenther@suse.de>
* gcc.dg/tree-ssa/ssa-fre-17.c: New testcase.
2008-04-17 Christian Bruel <christian.bruel@st.com> 2008-04-17 Christian Bruel <christian.bruel@st.com>
* gcc.dg/long-long-compare-1.c: New testcase. * gcc.dg/long-long-compare-1.c: New testcase.
/* { dg-do compile } */
/* { dg-options "-O -fdump-tree-fre-details -fno-tree-sra" } */
struct Bar {
int dom;
};
struct Foo {
struct Bar doms[3];
};
int foo(int i, int j, int k)
{
struct Foo f;
f.doms[0].dom = i;
f.doms[1].dom = j;
f.doms[2].dom = k;
return f.doms[0LL].dom;
}
/* { dg-final { scan-tree-dump "Replaced f.doms\\\[0\\\].dom with i_" "fre" } } */
/* { dg-final { cleanup-tree-dump "fre" } } */
...@@ -511,7 +511,8 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result) ...@@ -511,7 +511,8 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
vn_reference_op_s temp; vn_reference_op_s temp;
memset (&temp, 0, sizeof (temp)); memset (&temp, 0, sizeof (temp));
temp.type = TREE_TYPE (ref); /* We do not care for spurious type qualifications. */
temp.type = TYPE_MAIN_VARIANT (TREE_TYPE (ref));
temp.opcode = TREE_CODE (ref); temp.opcode = TREE_CODE (ref);
switch (temp.opcode) switch (temp.opcode)
...@@ -528,6 +529,10 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result) ...@@ -528,6 +529,10 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
temp.op1 = TREE_OPERAND (ref, 2); temp.op1 = TREE_OPERAND (ref, 2);
break; break;
case COMPONENT_REF: case COMPONENT_REF:
/* The field decl is enough to unambiguously specify the field,
a matching type is not necessary and a mismatching type
is always a spurious difference. */
temp.type = NULL_TREE;
/* 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
...@@ -536,10 +541,7 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result) ...@@ -536,10 +541,7 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result)
&& 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.type = NULL_TREE;
temp.op0 = TYPE_SIZE (TREE_TYPE (TREE_OPERAND (ref, 1)));
}
else else
/* Record field as operand. */ /* Record field as operand. */
temp.op0 = TREE_OPERAND (ref, 1); temp.op0 = TREE_OPERAND (ref, 1);
......
...@@ -83,8 +83,6 @@ expressions_equal_p (tree e1, tree e2) ...@@ -83,8 +83,6 @@ expressions_equal_p (tree e1, tree e2)
} }
else if (TREE_CODE (e1) == TREE_CODE (e2) else if (TREE_CODE (e1) == TREE_CODE (e2)
&& (te1 == te2
|| types_compatible_p (te1, te2))
&& operand_equal_p (e1, e2, OEP_PURE_SAME)) && operand_equal_p (e1, e2, OEP_PURE_SAME))
return true; return true;
......
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