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-3406] Avoid PHI - PHI recurrence in vectorization
Date: Thu, 20 Oct 2022 10:50:03 +0000 (GMT)	[thread overview]
Message-ID: <20221020105003.862353851171@sourceware.org> (raw)

https://gcc.gnu.org/g:5362b5cc8dba9de70904613fff1d5391a9c087ce

commit r13-3406-g5362b5cc8dba9de70904613fff1d5391a9c087ce
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Oct 20 11:04:21 2022 +0200

    Avoid PHI - PHI recurrence in vectorization
    
    The reported regression of libgomp loop-14.C shows that there isn't
    generally a good reliable place to insert the permute upfront so
    the following simply restricts recurrence vectorization to the cases
    where the latch value isn't defined by a PHI.
    
            * tree-vect-loop.cc (vect_phi_first_order_recurrence_p):
            Disallow latch PHI defs.
            (vectorizable_recurr): Revert previous change.

Diff:
---
 gcc/tree-vect-loop.cc | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 92790bd8095..d5c2bff80be 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -543,6 +543,7 @@ vect_phi_first_order_recurrence_p (loop_vec_info loop_vinfo, class loop *loop,
   tree ldef = PHI_ARG_DEF_FROM_EDGE (phi, latch);
   if (TREE_CODE (ldef) != SSA_NAME
       || SSA_NAME_IS_DEFAULT_DEF (ldef)
+      || is_a <gphi *> (SSA_NAME_DEF_STMT (ldef))
       || !flow_bb_inside_loop_p (loop, gimple_bb (SSA_NAME_DEF_STMT (ldef))))
     return false;
 
@@ -8486,14 +8487,8 @@ vectorizable_recurr (loop_vec_info loop_vinfo, stmt_vec_info stmt_info,
      vectorized the latch definition.  */
   edge le = loop_latch_edge (LOOP_VINFO_LOOP (loop_vinfo));
   gimple *latch_def = SSA_NAME_DEF_STMT (PHI_ARG_DEF_FROM_EDGE (phi, le));
-  gimple_stmt_iterator gsi2;
-  if (is_a <gphi *> (latch_def))
-    gsi2 = gsi_after_labels (gimple_bb (latch_def));
-  else
-    {
-      gsi2 = gsi_for_stmt (latch_def);
-      gsi_next (&gsi2);
-    }
+  gimple_stmt_iterator gsi2 = gsi_for_stmt (latch_def);
+  gsi_next (&gsi2);
 
   for (unsigned i = 0; i < ncopies; ++i)
     {

                 reply	other threads:[~2022-10-20 10:50 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=20221020105003.862353851171@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).