public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/guojiufu/heads/personal-branch)] tree-optimization/95576 - fix compare-debug issue with SLP vectorization
@ 2020-06-13  2:53 Jiu Fu Guo
  0 siblings, 0 replies; only message in thread
From: Jiu Fu Guo @ 2020-06-13  2:53 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:36e95a9e539a08275a0a6ef542a7fae5baa5710f

commit 36e95a9e539a08275a0a6ef542a7fae5baa5710f
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jun 10 15:16:23 2020 +0200

    tree-optimization/95576 - fix compare-debug issue with SLP vectorization
    
    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.

Diff:
---
 gcc/testsuite/g++.dg/vect/pr95576.cc | 23 +++++++++++++++++++++++
 gcc/tree-vect-slp.c                  |  9 ++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/gcc/testsuite/g++.dg/vect/pr95576.cc b/gcc/testsuite/g++.dg/vect/pr95576.cc
new file mode 100644
index 00000000000..64e0e2dae7f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/vect/pr95576.cc
@@ -0,0 +1,23 @@
+// { 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() {}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 0217a524f05..866ce8d3717 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -3316,7 +3316,12 @@ vect_slp_bb (basic_block bb)
 	{
 	  gimple *stmt = gsi_stmt (gsi);
 	  if (is_gimple_debug (stmt))
-	    continue;
+	    {
+	      /* Skip leading debug stmts.  */
+	      if (gsi_stmt (region_begin) == stmt)
+		gsi_next (&region_begin);
+	      continue;
+	    }
 	  insns++;
 
 	  if (gimple_location (stmt) != UNKNOWN_LOCATION)
@@ -3325,6 +3330,8 @@ vect_slp_bb (basic_block bb)
 	  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))


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

only message in thread, other threads:[~2020-06-13  2:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-13  2:53 [gcc(refs/users/guojiufu/heads/personal-branch)] tree-optimization/95576 - fix compare-debug issue with SLP vectorization Jiu Fu Guo

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).