diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-17 09:09:31 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-04-17 09:09:31 +0000 |
commit | 659ce413ebf46451f3b81dd2347e7705405dc5a6 (patch) | |
tree | f8f7712b31bdddfc402983df7bb2949ee076e2cb /gcc/tree-ssa-sccvn.c | |
parent | 374b31eeb2b04a436ab55139b79a774f0225fbc1 (diff) | |
download | gcc-659ce413ebf46451f3b81dd2347e7705405dc5a6.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134384 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 849eade1d21..6fc0840150f 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -511,7 +511,8 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result) vn_reference_op_s 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); switch (temp.opcode) @@ -528,6 +529,10 @@ copy_reference_ops_from_ref (tree ref, VEC(vn_reference_op_s, heap) **result) temp.op1 = TREE_OPERAND (ref, 2); break; 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 member size as operand. Do so only if we are doing 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) && 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.type = NULL_TREE; - temp.op0 = TYPE_SIZE (TREE_TYPE (TREE_OPERAND (ref, 1))); - } + temp.op0 = TYPE_SIZE (TREE_TYPE (TREE_OPERAND (ref, 1))); else /* Record field as operand. */ temp.op0 = TREE_OPERAND (ref, 1); |