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 r14-9993] tree-optimization/114736 - SLP DFS walk issue
Date: Tue, 16 Apr 2024 10:37:27 +0000 (GMT)	[thread overview]
Message-ID: <20240416103727.D4BC13846070@sourceware.org> (raw)

https://gcc.gnu.org/g:f949481a1f7ab973608a4ffcc0e342ab5a74e8e4

commit r14-9993-gf949481a1f7ab973608a4ffcc0e342ab5a74e8e4
Author: Richard Biener <rguenther@suse.de>
Date:   Tue Apr 16 11:33:48 2024 +0200

    tree-optimization/114736 - SLP DFS walk issue
    
    The following fixes a DFS walk issue when identifying to be ignored
    latch edges.  We have (bogus) SLP_TREE_REPRESENTATIVEs for VEC_PERM
    nodes so those have to be explicitly ignored as possibly being PHIs.
    
            PR tree-optimization/114736
            * tree-vect-slp.cc (vect_optimize_slp_pass::is_cfg_latch_edge):
            Do not consider VEC_PERM_EXPRs as PHI use.
    
            * gfortran.dg/vect/pr114736.f90: New testcase.

Diff:
---
 gcc/testsuite/gfortran.dg/vect/pr114736.f90 | 14 ++++++++++++++
 gcc/tree-vect-slp.cc                        |  3 ++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/gfortran.dg/vect/pr114736.f90 b/gcc/testsuite/gfortran.dg/vect/pr114736.f90
new file mode 100644
index 00000000000..cdbfb6f415a
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/vect/pr114736.f90
@@ -0,0 +1,14 @@
+! { dg-do compile }
+! { dg-additional-options "-O3" }
+
+SUBROUTINE MY_ROUTINE (N, A, B )
+IMPLICIT NONE
+INTEGER,   INTENT(IN)    :: N
+COMPLEX,   INTENT(IN)    :: A(N)
+COMPLEX,   INTENT(OUT)   :: B(N)
+INTEGER                  :: II
+B(:) = (1.,0.)
+DO II = 1, N-1
+    B(II) = A(N-II+1) / A(N-II)
+ENDDO
+END SUBROUTINE MY_ROUTINE
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index f57684ca685..30589e19a17 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -4309,7 +4309,8 @@ vect_optimize_slp_pass::is_cfg_latch_edge (graph_edge *ud)
 {
   slp_tree use = m_vertices[ud->src].node;
   slp_tree def = m_vertices[ud->dest].node;
-  if (SLP_TREE_DEF_TYPE (use) != vect_internal_def
+  if ((SLP_TREE_DEF_TYPE (use) != vect_internal_def
+       || SLP_TREE_CODE (use) == VEC_PERM_EXPR)
       || SLP_TREE_DEF_TYPE (def) != vect_internal_def)
     return false;

                 reply	other threads:[~2024-04-16 10:37 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=20240416103727.D4BC13846070@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).