public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Richard Biener <rguenth@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-3544] tree-optimization/107435 - ICE with recurrence vectorization
Date: Fri, 28 Oct 2022 13:07:20 +0000 (GMT)	[thread overview]
Message-ID: <20221028130720.B24733885C13@sourceware.org> (raw)

https://gcc.gnu.org/g:084128583212bd64308f50c2ab5f4c03be40e48c

commit r13-3544-g084128583212bd64308f50c2ab5f4c03be40e48c
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Oct 28 13:50:57 2022 +0200

    tree-optimization/107435 - ICE with recurrence vectorization
    
    This implements the missed conversion from pointer to integer.
    
            PR tree-optimization/107435
            * tree-vect-loop.cc (vectorizable_recurr): Convert initial
            value to vector component type.
    
            * gcc.dg/torture/pr107435.c: New testcase.

Diff:
---
 gcc/testsuite/gcc.dg/torture/pr107435.c | 23 +++++++++++++++++++++++
 gcc/tree-vect-loop.cc                   |  6 ++++++
 2 files changed, 29 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/torture/pr107435.c b/gcc/testsuite/gcc.dg/torture/pr107435.c
new file mode 100644
index 00000000000..10128969191
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr107435.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-mavx2" { target x86_64-*-* i?86-*-* } } */
+
+struct qlist_head {
+  struct qlist_head *next;
+};
+void
+qlist_add (struct qlist_head *new, struct qlist_head *head)
+{
+  struct qlist_head *prev = head;
+  new->next = head->next;
+  prev->next = new;
+}
+struct {
+  struct qlist_head queue_link;
+} free_list, prealloc[64];
+void
+dbpf_open_cache_initialize()
+{
+  int i = 0;
+  for (; i < 64; i++)
+    qlist_add(&prealloc[i].queue_link, &free_list.queue_link);
+}
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index d5c2bff80be..aacbb12580c 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -8469,6 +8469,12 @@ vectorizable_recurr (loop_vec_info loop_vinfo, stmt_vec_info stmt_info,
   edge pe = loop_preheader_edge (LOOP_VINFO_LOOP (loop_vinfo));
   basic_block bb = gimple_bb (phi);
   tree preheader = PHI_ARG_DEF_FROM_EDGE (phi, pe);
+  if (!useless_type_conversion_p (TREE_TYPE (vectype), TREE_TYPE (preheader)))
+    {
+      gimple_seq stmts = NULL;
+      preheader = gimple_convert (&stmts, TREE_TYPE (vectype), preheader);
+      gsi_insert_seq_on_edge_immediate (pe, stmts);
+    }
   tree vec_init = build_vector_from_val (vectype, preheader);
   vec_init = vect_init_vector (loop_vinfo, stmt_info, vec_init, vectype, NULL);

                 reply	other threads:[~2022-10-28 13:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221028130720.B24733885C13@sourceware.org \
    --to=rguenth@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).