diff mbox

Fix VN value-numbering with VIEW_CONVERT_EXPRs

Message ID alpine.LNX.2.00.1201251501150.4999@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Jan. 25, 2012, 2:11 p.m. UTC
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.
diff mbox

Patch

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;