public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-8831] tree-optimization/101505 - properly determine stmt precision for PHIs
@ 2021-08-06  9:43 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-08-06  9:43 UTC (permalink / raw)
  To: gcc-cvs

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

commit r11-8831-gc891d268c446bd01f82e256e24580afcb3b526ae
Author: Richard Biener <rguenther@suse.de>
Date:   Mon Jul 19 13:29:16 2021 +0200

    tree-optimization/101505 - properly determine stmt precision for PHIs
    
    Loop vectorization pattern recog fails to walk PHIs when determining
    stmt precisions.  This fails to recognize non-mask uses for bools
    in PHIs and outer loop vectorization.
    
    2021-07-19  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/101505
            * tree-vect-patterns.c (vect_determine_precisions): Walk
            PHIs also for loop vectorization.
    
            * gcc.dg/vect/pr101505.c: New testcase.
    
    (cherry picked from commit 8df3ee8f7d85d0708f3c3ca96b55c9230c2ae9f0)

Diff:
---
 gcc/testsuite/gcc.dg/vect/pr101505.c | 16 ++++++++++++++++
 gcc/tree-vect-patterns.c             | 14 ++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/gcc/testsuite/gcc.dg/vect/pr101505.c b/gcc/testsuite/gcc.dg/vect/pr101505.c
new file mode 100644
index 00000000000..e2b8945a5cc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr101505.c
@@ -0,0 +1,16 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-O1" } */
+
+int n2;
+
+__attribute__ ((simd)) char
+w7 (void)
+{
+  short int xb = n2;
+  int qp;
+
+  for (qp = 0; qp < 2; ++qp)
+    xb = xb < 1;
+
+  return xb;
+}
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c
index 803de3fc287..18398da584a 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -5198,6 +5198,13 @@ vect_determine_precisions (vec_info *vinfo)
       for (unsigned int i = 0; i < nbbs; i++)
 	{
 	  basic_block bb = bbs[i];
+	  for (auto gsi = gsi_start_phis (bb);
+	       !gsi_end_p (gsi); gsi_next (&gsi))
+	    {
+	      stmt_vec_info stmt_info = vinfo->lookup_stmt (gsi.phi ());
+	      if (stmt_info)
+		vect_determine_mask_precision (vinfo, stmt_info);
+	    }
 	  for (auto si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si))
 	    if (!is_gimple_debug (gsi_stmt (si)))
 	      vect_determine_mask_precision
@@ -5211,6 +5218,13 @@ vect_determine_precisions (vec_info *vinfo)
 	    if (!is_gimple_debug (gsi_stmt (si)))
 	      vect_determine_stmt_precisions
 		(vinfo, vinfo->lookup_stmt (gsi_stmt (si)));
+	  for (auto gsi = gsi_start_phis (bb);
+	       !gsi_end_p (gsi); gsi_next (&gsi))
+	    {
+	      stmt_vec_info stmt_info = vinfo->lookup_stmt (gsi.phi ());
+	      if (stmt_info)
+		vect_determine_stmt_precisions (vinfo, stmt_info);
+	    }
 	}
     }
   else


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

only message in thread, other threads:[~2021-08-06  9:43 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-06  9:43 [gcc r11-8831] tree-optimization/101505 - properly determine stmt precision for PHIs Richard Biener

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