public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-8005] tree-optimization/99880 - avoid vectorizing irrelevant PHI backedge defs
@ 2021-04-06 12:20 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-04-06 12:20 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:e5c170e080399fb3d24a38bbfcd66bd4675abe53
commit r11-8005-ge5c170e080399fb3d24a38bbfcd66bd4675abe53
Author: Richard Biener <rguenther@suse.de>
Date: Tue Apr 6 13:20:44 2021 +0200
tree-optimization/99880 - avoid vectorizing irrelevant PHI backedge defs
This adds a relevancy check before trying to set the vector def of
a backedge in an unvectorized PHI.
2021-04-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/99880
* tree-vect-loop.c (maybe_set_vectorized_backedge_value): Only
set vectorized defs of relevant PHIs.
* gcc.dg/torture/pr99880.c: New testcase.
Diff:
---
gcc/testsuite/gcc.dg/torture/pr99880.c | 22 ++++++++++++++++++++++
gcc/tree-vect-loop.c | 1 +
2 files changed, 23 insertions(+)
diff --git a/gcc/testsuite/gcc.dg/torture/pr99880.c b/gcc/testsuite/gcc.dg/torture/pr99880.c
new file mode 100644
index 00000000000..7e0989987d7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr99880.c
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-ftree-vectorize" } */
+
+unsigned a;
+int b, c, d, e;
+void f() {
+ b = 5;
+ for (; b <= 51; b++)
+ ;
+ unsigned int g = -8;
+ while (g) {
+ g += 5;
+ int h = 10;
+ do {
+ h -= a = 1;
+ for (; a; a++)
+ ;
+ c *= c >= d >= b;
+ } while (h);
+ c -= e;
+ }
+}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 38d96fc1634..4e928c65b31 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -9148,6 +9148,7 @@ maybe_set_vectorized_backedge_value (loop_vec_info loop_vinfo,
if (gphi *phi = dyn_cast <gphi *> (USE_STMT (use_p)))
if (gimple_bb (phi)->loop_father->header == gimple_bb (phi)
&& (phi_info = loop_vinfo->lookup_stmt (phi))
+ && STMT_VINFO_RELEVANT_P (phi_info)
&& VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (phi_info))
&& STMT_VINFO_REDUC_TYPE (phi_info) != FOLD_LEFT_REDUCTION
&& STMT_VINFO_REDUC_TYPE (phi_info) != EXTRACT_LAST_REDUCTION)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-06 12:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-06 12:20 [gcc r11-8005] tree-optimization/99880 - avoid vectorizing irrelevant PHI backedge defs 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).