public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Kewen Lin <linkw@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-1083] vect: Move suggested_unroll_factor applying [PR105940]
Date: Tue, 14 Jun 2022 05:58:23 +0000 (GMT)	[thread overview]
Message-ID: <20220614055823.BC9B13858C52@sourceware.org> (raw)

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

commit r13-1083-gf907cf4c07cf51863dadbe90894e2ae3382bada5
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Tue Jun 14 00:57:01 2022 -0500

    vect: Move suggested_unroll_factor applying [PR105940]
    
    As PR105940 shown, when rs6000 port tries to assign
    m_suggested_unroll_factor by 4 or so, there will be ICE on:
    
      exact_div (LOOP_VINFO_VECT_FACTOR (loop_vinfo),
                 loop_vinfo->suggested_unroll_factor);
    
    In function vect_analyze_loop_2, the current place of
    suggested_unroll_factor applying can't guarantee it's
    applied for all cases.  As the case shows, vectorizer
    could retry with SLP forced off, the vf is reset by
    saved_vectorization_factor which isn't applied with
    suggested_unroll_factor before.  It means it can end
    up with one vf which neglects suggested_unroll_factor.
    I think it's off design, we should move the applying
    of suggested_unroll_factor after start_over.
    
            PR tree-optimization/105940
    
    gcc/ChangeLog:
    
            * tree-vect-loop.cc (vect_analyze_loop_2): Move the place of
            applying suggested_unroll_factor after start_over.

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

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 246347b9b08..e05f8e87f7d 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -2388,15 +2388,15 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal,
      set of rgroups.  */
   gcc_assert (LOOP_VINFO_MASKS (loop_vinfo).is_empty ());
 
+  /* This is the point where we can re-start analysis with SLP forced off.  */
+start_over:
+
   /* Apply the suggested unrolling factor, this was determined by the backend
      during finish_cost the first time we ran the analyzis for this
      vector mode.  */
   if (loop_vinfo->suggested_unroll_factor > 1)
     LOOP_VINFO_VECT_FACTOR (loop_vinfo) *= loop_vinfo->suggested_unroll_factor;
 
-  /* This is the point where we can re-start analysis with SLP forced off.  */
-start_over:
-
   /* Now the vectorization factor is final.  */
   poly_uint64 vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
   gcc_assert (known_ne (vectorization_factor, 0U));


                 reply	other threads:[~2022-06-14  5:58 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=20220614055823.BC9B13858C52@sourceware.org \
    --to=linkw@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).