From: Richard Biener <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] tree-optimization/101505 - properly determine stmt precision for PHIs
Date: Mon, 19 Jul 2021 14:21:33 +0200 (CEST) [thread overview]
Message-ID: <sqn83976-r82r-4n9-888-68p68r79q76@fhfr.qr> (raw)
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.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
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.
---
gcc/testsuite/gcc.dg/vect/pr101505.c | 16 ++++++++++++++++
gcc/tree-vect-patterns.c | 14 ++++++++++++++
2 files changed, 30 insertions(+)
create mode 100644 gcc/testsuite/gcc.dg/vect/pr101505.c
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 c2494446183..44f6c9b2bd6 100644
--- a/gcc/tree-vect-patterns.c
+++ b/gcc/tree-vect-patterns.c
@@ -5355,6 +5355,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
@@ -5368,6 +5375,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
--
2.26.2
reply other threads:[~2021-07-19 12:21 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=sqn83976-r82r-4n9-888-68p68r79q76@fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@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).