public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] tree-optimization/97769 - fix assert in peeling for alignment
@ 2020-11-10 12:38 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2020-11-10 12:38 UTC (permalink / raw)
  To: gcc-patches

The following removes an assert that can not easily be adjusted to
cover the additional cases we now handle after the removal of
the same-align DRs vector.

Tested on x86_64-unknown-linux and aarch64, pushed.

2020-11-10  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/97769
	* tree-vect-data-refs.c (vect_update_misalignment_for_peel):
	Remove assert.

	* gcc.dg/vect/pr97769.c: New testcase.
---
 gcc/testsuite/gcc.dg/vect/pr97769.c | 32 +++++++++++++++++++++++++++++
 gcc/tree-vect-data-refs.c           |  7 +------
 2 files changed, 33 insertions(+), 6 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/vect/pr97769.c

diff --git a/gcc/testsuite/gcc.dg/vect/pr97769.c b/gcc/testsuite/gcc.dg/vect/pr97769.c
new file mode 100644
index 00000000000..127f91aa8fd
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr97769.c
@@ -0,0 +1,32 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O3" } */
+
+typedef struct {
+    int alg;
+    int h1[8];
+    unsigned d1[1];
+} tmp;
+typedef struct {
+    tmp itmp;
+    tmp otmp;
+} h1;
+h1 c;
+
+static void
+fn1(char *p1, int p2)
+{
+  int i = 0;
+  for (; i < 4; i++)
+    *p1++ = p2;
+}
+
+static void
+fn2(tmp *p1)
+{
+  char *d = (char *)p1->d1;
+  int *b = p1->h1;
+  for (int a; a; a++, d += 4)
+    fn1(d, *b++);
+}
+
+void fn3() { fn2(&(&c)->otmp); }
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 8afd3044461..0efab495407 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -1186,14 +1186,9 @@ static void
 vect_update_misalignment_for_peel (dr_vec_info *dr_info,
 				   dr_vec_info *dr_peel_info, int npeel)
 {
-  /* It can be assumed that if dr_info has the same alignment as dr_peel,
-     it is aligned in the vector loop.  */
+  /* If dr_info is aligned of dr_peel_info is, then mark it so.  */
   if (vect_dr_aligned_if_peeled_dr_is (dr_info, dr_peel_info))
     {
-      gcc_assert (!known_alignment_for_access_p (dr_info)
-		  || !known_alignment_for_access_p (dr_peel_info)
-		  || (DR_MISALIGNMENT (dr_info)
-		      == DR_MISALIGNMENT (dr_peel_info)));
       SET_DR_MISALIGNMENT (dr_info, 0);
       return;
     }
-- 
2.26.2

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

only message in thread, other threads:[~2020-11-10 12:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10 12:38 [PATCH] tree-optimization/97769 - fix assert in peeling for alignment 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).