public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-10045] tree-optimization/105437 - BB vect with extern defs of throwing stmts
@ 2022-06-02 10:56 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-06-02 10:56 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:462e7e2c6fe0bc57e03110d43a2c7e53a1ce04ea

commit r11-10045-g462e7e2c6fe0bc57e03110d43a2c7e53a1ce04ea
Author: Richard Biener <rguenther@suse.de>
Date:   Mon May 2 09:30:27 2022 +0200

    tree-optimization/105437 - BB vect with extern defs of throwing stmts
    
    We have to watch out for vectorized stmt insert locations if the
    def from the last stmt alters control flow.  We constrain region
    building so we know the def is outside of the current region
    and thus we can insert at the region start point.
    
    2022-05-02  Richard Biener  <rguenther@suse.de>
    
            PR tree-optimization/105437
            * tree-vect-slp.c (vect_schedule_slp_node): Handle the
            case where last_stmt alters control flow.
    
            * g++.dg/vect/pr105437.cc: New testcase.
    
    (cherry picked from commit 3a3eda000fdf4f8754c9a2535191091f1db0c2a2)

Diff:
---
 gcc/testsuite/g++.dg/vect/pr105437.cc | 24 ++++++++++++++++++++++++
 gcc/tree-vect-slp.c                   |  7 +++++++
 2 files changed, 31 insertions(+)

diff --git a/gcc/testsuite/g++.dg/vect/pr105437.cc b/gcc/testsuite/g++.dg/vect/pr105437.cc
new file mode 100644
index 00000000000..b3b440debef
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr105437.cc
@@ -0,0 +1,24 @@
+// { dg-do compile }
+
+struct ControlClass
+{
+    virtual ~ControlClass();
+
+    int Width;
+    int Height;
+    unsigned IsToRepaint : 1;
+};
+
+struct SelectClass : ControlClass
+{
+    SelectClass(void);
+};
+
+int Non_Folded_Value();
+
+SelectClass::SelectClass(void)
+{
+    int factor = Non_Folded_Value();
+    Width = 32 << factor;
+    Height = 24 << factor;
+}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 7289656db0f..a034abf9628 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -6319,6 +6319,13 @@ vect_schedule_slp_node (vec_info *vinfo,
 	  gcc_assert (seen_vector_def);
 	  si = gsi_after_labels (as_a <bb_vec_info> (vinfo)->bbs[0]);
 	}
+      else if (is_ctrl_altering_stmt (last_stmt))
+	{
+	  /* We split regions to vectorize at control altering stmts
+	     with a definition so this must be an external which
+	     we can insert at the start of the region.  */
+	  si = gsi_after_labels (as_a <bb_vec_info> (vinfo)->bbs[0]);
+	}
       else if (is_a <bb_vec_info> (vinfo)
 	       && gimple_bb (last_stmt) != gimple_bb (stmt_info->stmt)
 	       && gimple_could_trap_p (stmt_info->stmt))


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

only message in thread, other threads:[~2022-06-02 10:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02 10:56 [gcc r11-10045] tree-optimization/105437 - BB vect with extern defs of throwing stmts 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).