public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-7364] vect: Don't retry if the previous analysis fails
@ 2023-05-22  2:35 Kewen Lin
  0 siblings, 0 replies; only message in thread
From: Kewen Lin @ 2023-05-22  2:35 UTC (permalink / raw)
  To: gcc-cvs

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

commit r13-7364-gdd36656ada05731c069ecd5b1878380294fb1f3e
Author: Kewen Lin <linkw@linux.ibm.com>
Date:   Wed May 17 02:48:40 2023 -0500

    vect: Don't retry if the previous analysis fails
    
    When working on a cost tweaking patch, I found that a newly
    added test case has different dumpings with stage-1 and
    bootstrapped gcc.  By looking into it, the apparent reason
    is vect_analyze_loop_2 doesn't get slp_done_for_suggested_uf
    set expectedly, the following retrying will use the garbage
    slp_done_for_suggested_uf instead.  In fact, the setting of
    slp_done_for_suggested_uf only happens when the previous
    analysis succeeds, for the mentioned test case, its previous
    analysis does fail, it's unexpected to use the value of
    slp_done_for_suggested_uf any more.
    
    In function vect_analyze_loop_1, we only return success when
    res is true, which is the result of 1st analysis.  It means
    we never try to vectorize with unroll_vinfo if the previous
    analysis fails.  So this patch shouldn't break anything, and
    just stop some useless analysis early.
    
    gcc/ChangeLog:
    
            * tree-vect-loop.cc (vect_analyze_loop_1): Don't retry analysis with
            suggested unroll factor once the previous analysis fails.
    
    (cherry picked from commit a04bf39f61ce7814d197d712760f08c206daf4f1)

Diff:
---
 gcc/tree-vect-loop.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 6ea0f21fd13..92d2e0ef9be 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -3044,7 +3044,7 @@ vect_analyze_loop_1 (class loop *loop, vec_info_shared *shared,
 		     res ? "succeeded" : " failed",
 		     GET_MODE_NAME (loop_vinfo->vector_mode));
 
-  if (!main_loop_vinfo && suggested_unroll_factor > 1)
+  if (res && !main_loop_vinfo && suggested_unroll_factor > 1)
     {
       if (dump_enabled_p ())
 	dump_printf_loc (MSG_NOTE, vect_location,

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

only message in thread, other threads:[~2023-05-22  2:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22  2:35 [gcc r13-7364] vect: Don't retry if the previous analysis fails Kewen Lin

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).