tree-ssa-sccvn.c (vn_reference_lookup_3): Remove restriction of fixed offset from...
authorRichard Biener <rguenther@suse.de>
Wed, 23 May 2018 14:01:36 +0000 (14:01 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 23 May 2018 14:01:36 +0000 (14:01 +0000)
2018-05-23  Richard Biener  <rguenther@suse.de>

* tree-ssa-sccvn.c (vn_reference_lookup_3): Remove restriction
of fixed offset from memset VN.

* gcc.dg/tree-ssa/ssa-fre-66.c: New testcase.

From-SVN: r260609

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-66.c [new file with mode: 0644]
gcc/tree-ssa-sccvn.c

index 09a70256d764bb207b077c9a7810b2605e3d5ec1..d377909fba44e28b1dc42db9a8d852c2a21e1606 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-23  Richard Biener  <rguenther@suse.de>
+
+       * tree-ssa-sccvn.c (vn_reference_lookup_3): Remove restriction
+       of fixed offset from memset VN.
+
 2018-05-23  Bill Schmidt  <wschmidt@linux.ibm.com>
 
        * gimple-ssa-strength-reduction.c (struct slsr_cand_d): Add
index aea02b9085aa5f4c01ffe54da92634f5dd76db47..b3cf4b1fd95c04b5fc9a87d0c34e8c16fcd9eb71 100644 (file)
@@ -1,3 +1,7 @@
+2018-05-23  Richard Biener  <rguenther@suse.de>
+
+       * gcc.dg/tree-ssa/ssa-fre-66.c: New testcase.
+
 2018-05-23  Sudakshina Das  <sudi.das@arm.com>
 
        PR target/84882
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-66.c b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-66.c
new file mode 100644 (file)
index 0000000..1c86a1f
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-fre1" } */
+
+int foo (int i)
+{
+  int a[16];
+  __builtin_memset (a, 42, sizeof (a));
+  return a[i];
+}
+
+/* { dg-final { scan-tree-dump "return 707406378;" "fre1" { target { int32plus } } } } */
index 96e80c7b5a3058553a8f69921976b9326a001017..73e8fc5df49b8493cade3c3ad6027cb676505d70 100644 (file)
@@ -1962,7 +1962,6 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_,
          || ((TREE_CODE (gimple_call_arg (def_stmt, 1)) == INTEGER_CST
               || (INTEGRAL_TYPE_P (vr->type) && known_eq (ref->size, 8)))
              && CHAR_BIT == 8 && BITS_PER_UNIT == 8
-             && known_eq (ref->size, maxsize)
              && offset.is_constant (&offseti)
              && offseti % BITS_PER_UNIT == 0))
       && poly_int_tree_p (gimple_call_arg (def_stmt, 2))