diff options
author | Richard Biener <rguenther@suse.de> | 2019-12-04 13:21:39 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-12-04 13:21:39 +0000 |
commit | 6d8d58a852b54b9e3002b62ea0e658a9a4bfbb93 (patch) | |
tree | 2ddae30a5f098ba49c5d93059bf2fd4c632c45da /gcc | |
parent | 7b86aaf45c00ec038a0da003f41d5334a00e603c (diff) | |
download | gcc-6d8d58a852b54b9e3002b62ea0e658a9a4bfbb93.zip gcc-6d8d58a852b54b9e3002b62ea0e658a9a4bfbb93.tar.gz gcc-6d8d58a852b54b9e3002b62ea0e658a9a4bfbb93.tar.bz2 |
tree-ssa-sccvn.c (vn_reference_lookup_3): Properly guard empty CTOR and memset partial-def registering.
2019-12-04 Richard Biener <rguenther@suse.de>
* tree-ssa-sccvn.c (vn_reference_lookup_3): Properly guard
empty CTOR and memset partial-def registering. Take advantage
of fancy offset analysis in memset handling.
From-SVN: r278965
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 13 |
2 files changed, 17 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d80a8a8..29359ee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-12-04 Richard Biener <rguenther@suse.de> + + * tree-ssa-sccvn.c (vn_reference_lookup_3): Properly guard + empty CTOR and memset partial-def registering. Take advantage + of fancy offset analysis in memset handling. + 2019-12-04 Richard Sandiford <richard.sandiford@arm.com> * fold-const.c (native_encode_vector_part): Handle diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index b90ce37..4c70e2a 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2441,6 +2441,12 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, return (void *)-1; tree len = gimple_call_arg (def_stmt, 2); HOST_WIDE_INT leni, offset2i, offseti; + /* Sometimes the above trickery is smarter than alias analysis. Take + advantage of that. */ + if (!ranges_maybe_overlap_p (offset, maxsize, offset2, + (wi::to_poly_offset (len) + << LOG2_BITS_PER_UNIT))) + return NULL; if (data->partial_defs.is_empty () && known_subrange_p (offset, maxsize, offset2, wi::to_poly_offset (len) << LOG2_BITS_PER_UNIT)) @@ -2478,7 +2484,8 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, && tree_to_poly_int64 (len).is_constant (&leni) && offset.is_constant (&offseti) && offset2.is_constant (&offset2i) - && maxsize.is_constant (&maxsizei)) + && maxsize.is_constant (&maxsizei) + && ranges_known_overlap_p (offseti, maxsizei, offset2i, leni)) { pd_data pd; pd.rhs = build_constructor (NULL_TREE, NULL); @@ -2534,7 +2541,9 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, && offset2.is_constant (&offset2i) && offset2i % BITS_PER_UNIT == 0 && size2.is_constant (&size2i) - && size2i % BITS_PER_UNIT == 0) + && size2i % BITS_PER_UNIT == 0 + && ranges_known_overlap_p (offseti, maxsizei, + offset2i, size2i)) { /* Let clobbers be consumed by the partial-def tracker which can choose to ignore them if they are shadowed |