Patchwork Fix VN value-numbering with VIEW_CONVERT_EXPRs

login
register
mail settings
Submitter Richard Guenther
Date Jan. 25, 2012, 2:11 p.m.
Message ID <alpine.LNX.2.00.1201251501150.4999@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/137769/
State New
Headers show

Comments

Richard Guenther - Jan. 25, 2012, 2:11 p.m.
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.

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;