re PR tree-optimization/70701 (incomplete value numbering when memcpy-ing from array)
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. * gcc.dg/tree-ssa/ssa-fre-53.c: New testcase. From-SVN: r235131
This commit is contained in:
parent
65833da69d
commit
edd048e29a
|
@ -1,3 +1,9 @@
|
|||
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 ...
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
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
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
/* { 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" } } */
|
|
@ -2152,6 +2152,12 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_,
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue