aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2022-05-02 09:30:27 +0200
committerRichard Biener <rguenther@suse.de>2022-05-02 10:43:40 +0200
commit3a3eda000fdf4f8754c9a2535191091f1db0c2a2 (patch)
tree2a87f4a9948f63e93e70a215daedc2ac9c45d70c /gcc
parent82a344f206725ba002af4fed318f37dfb7e566a0 (diff)
downloadgcc-3a3eda000fdf4f8754c9a2535191091f1db0c2a2.zip
gcc-3a3eda000fdf4f8754c9a2535191091f1db0c2a2.tar.gz
gcc-3a3eda000fdf4f8754c9a2535191091f1db0c2a2.tar.bz2
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.cc (vect_schedule_slp_node): Handle the case where last_stmt alters control flow. * g++.dg/vect/pr105437.cc: New testcase.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/g++.dg/vect/pr105437.cc24
-rw-r--r--gcc/tree-vect-slp.cc7
2 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/vect/pr105437.cc b/gcc/testsuite/g++.dg/vect/pr105437.cc
new file mode 100644
index 0000000..b3b440d
--- /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.cc b/gcc/tree-vect-slp.cc
index 805dd7e..0d400c0 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -7302,6 +7302,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))