This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix VN value-numbering with VIEW_CONVERT_EXPRs
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 25 Jan 2012 15:11:04 +0100 (CET)
- Subject: [PATCH] Fix VN value-numbering with VIEW_CONVERT_EXPRs
VN ops comparison code value-numbers
VIEW_CONVERT_EXPR<struct iterator>(__thing_31).._M_node
and
__thing_31->_M_node
the same because it fails to check for *__thing_31 vs. __thing_31.
Bootstrap & regtest pending on x86_64.
Richard.
2012-01-25 Richard Guenther <rguenther@suse.de>
* tree-ssa-sccvn.c (vn_reference_eq): Also compare if both
bases are dereferenced.
Index: gcc/tree-ssa-sccvn.c
===================================================================
--- gcc/tree-ssa-sccvn.c (revision 183514)
+++ gcc/tree-ssa-sccvn.c (working copy)
@@ -556,6 +556,7 @@ vn_reference_eq (const void *p1, const v
tem1.type = TREE_TYPE (tem1.op0);
tem1.opcode = TREE_CODE (tem1.op0);
vro1 = &tem1;
+ deref1 = false;
}
if (deref2 && vro2->opcode == ADDR_EXPR)
{
@@ -564,7 +565,10 @@ vn_reference_eq (const void *p1, const v
tem2.type = TREE_TYPE (tem2.op0);
tem2.opcode = TREE_CODE (tem2.op0);
vro2 = &tem2;
+ deref2 = false;
}
+ if (deref1 != deref2)
+ return false;
if (!vn_reference_op_eq (vro1, vro2))
return false;
++j;