public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Remove memset VN restriction
@ 2018-05-23 14:03 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2018-05-23 14:03 UTC (permalink / raw)
  To: gcc-patches


After Eric reminded me how things go with the middle-end and bit-offsets
the following adjusts VN accordingly.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

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.

On branch slpcost
Your branch is ahead of 'origin/trunk' by 1 commit.
  (use "git push" to publish your local commits)
Changes to be committed:
  (use "git reset HEAD <file>..." to unstage)

	new file:   testsuite/gcc.dg/tree-ssa/ssa-fre-66.c
	modified:   tree-ssa-sccvn.c

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
index 00000000000..1c86a1f3866
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-66.c
@@ -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 } } } } */
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 96e80c7b5a3..73e8fc5df49 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -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))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-05-23 13:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-23 14:03 [PATCH] Remove memset VN restriction Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).