The following avoids leading debug stmts in BB vectorizer regions.
2020-06-10 Richard Biener <rguenther@suse.de>
PR tree-optimization/95576
* tree-vect-slp.c (vect_slp_bb): Skip leading debug stmts.
* g++.dg/vect/pr95576.cc: New testcase.
--- /dev/null
+// { dg-do compile }
+// { dg-additional-options "-O3 -fno-tree-forwprop -fcompare-debug" }
+
+struct S {
+ virtual ~S();
+ struct S *s;
+ virtual void m();
+ int f;
+ void *d;
+};
+
+struct T : S {
+ void m();
+};
+
+S::~S() {
+ if (s) {
+ s->f = 0;
+ s->d = __null;
+ }
+}
+
+void T::m() {}
{
gimple *stmt = gsi_stmt (gsi);
if (is_gimple_debug (stmt))
- continue;
+ {
+ /* Skip leading debug stmts. */
+ if (gsi_stmt (region_begin) == stmt)
+ gsi_next (®ion_begin);
+ continue;
+ }
insns++;
if (gimple_location (stmt) != UNKNOWN_LOCATION)
if (!vect_find_stmt_data_reference (NULL, stmt, &datarefs))
break;
}
+ if (gsi_end_p (region_begin))
+ break;
/* Skip leading unhandled stmts. */
if (gsi_stmt (region_begin) == gsi_stmt (gsi))