+2016-04-18 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/70701
+ * tree-ssa-sccvn.c (vn_reference_lookup_3): Resolve fully constant
+ references after translating through a memcpy.
+
2016-04-18 Richard Biener <rguenther@suse.de>
* tree-ssa-pre.c (postorder, postorder_num): Make locals ...
+2016-04-18 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/70701
+ * gcc.dg/tree-ssa/ssa-fre-53.c: New testcase.
+
2016-04-18 Tom de Vries <tom@codesourcery.com>
PR testsuite/70699
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O -fno-tree-forwprop -fdump-tree-fre1" } */
+
+const int a[]={1,2,3};
+int f(){
+ int*b=__builtin_malloc(12);
+ __builtin_memcpy(b,a,12);
+ return b[0];
+}
+
+/* { dg-final { scan-tree-dump "return 1;" "fre1" } } */
vr->operands[1] = op;
vr->hashcode = vn_reference_compute_hash (vr);
+ /* Try folding the new reference to a constant. */
+ tree val = fully_constant_vn_reference_p (vr);
+ if (val)
+ return vn_reference_lookup_or_insert_for_pieces
+ (vuse, vr->set, vr->type, vr->operands, val);
+
/* Adjust *ref from the new operands. */
if (!ao_ref_init_from_vn_reference (&r, vr->set, vr->type, vr->operands))
return (void *)-1;