diff options
author | Richard Biener <rguenther@suse.de> | 2018-11-28 13:51:42 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2018-11-28 13:51:42 +0000 |
commit | 2bf8ae1b3d539eb7170eba9336d06b8383c3eba2 (patch) | |
tree | 2e2738cd6f383fc65c0d5abaece478217a39c370 /gcc/tree-ssa-sccvn.c | |
parent | 5916922e348b0ae5bc1f308b5de9c75ffd20c339 (diff) | |
download | gcc-2bf8ae1b3d539eb7170eba9336d06b8383c3eba2.zip gcc-2bf8ae1b3d539eb7170eba9336d06b8383c3eba2.tar.gz gcc-2bf8ae1b3d539eb7170eba9336d06b8383c3eba2.tar.bz2 |
re PR tree-optimization/88223 (Wrong code for intrinsic memmove)
2018-11-28 Richard Biener <rguenther@suse.de>
PR tree-optimization/88223
* tree-ssa-sccvn.c (vn_reference_lookup_3): When skipping
over a stored-same value may-alias store make sure to consider
partial overlaps which are valid when TBAA reasonings do not
apply and byte-granular overlaps are possible at all.
* gcc.dg/torture/pr88223.c: New testcase.
From-SVN: r266560
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index b0b9d52..8f2b460 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -1927,7 +1927,16 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, VN_WALKREWRITE guard). */ if (vn_walk_kind == VN_WALKREWRITE && is_gimple_reg_type (TREE_TYPE (lhs)) - && types_compatible_p (TREE_TYPE (lhs), vr->type)) + && types_compatible_p (TREE_TYPE (lhs), vr->type) + /* The overlap restriction breaks down when either access + alias-set is zero. Still for accesses of the size of + an addressable unit there can be no overlaps. Overlaps + between different union members are not an issue since + activation of a union member via a store makes the + values of untouched bytes unspecified. */ + && (known_eq (ref->size, BITS_PER_UNIT) + || (get_alias_set (lhs) != 0 + && ao_ref_alias_set (ref) != 0))) { tree *saved_last_vuse_ptr = last_vuse_ptr; /* Do not update last_vuse_ptr in vn_reference_lookup_2. */ |