tree-optimization/97486 - avoid edge insertion in SLP vectorizing
authorRichard Biener <rguenther@suse.de>
Mon, 19 Oct 2020 09:30:46 +0000 (11:30 +0200)
committerRichard Biener <rguenther@suse.de>
Mon, 19 Oct 2020 11:22:49 +0000 (13:22 +0200)
This avoids edge inserting and eventual splitting during BB SLP
vectorization for now.

2020-10-19  Richard Biener  <rguenther@suse.de>

PR tree-optimization/97486
* tree-vect-slp.c (vect_slp_function): Split after stmts
ending a BB.

* gcc.dg/vect/bb-slp-pr97486.c: New testcase.

gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c [new file with mode: 0644]
gcc/tree-vect-slp.c

diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97486.c
new file mode 100644 (file)
index 0000000..17d48a7
--- /dev/null
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+
+struct {
+  int *end_info;
+  int *fp;
+} png_load_body_c;
+
+int *png_set_longjmp_fn();
+
+void setjmp();
+
+void png_load_body()
+{
+  int *fp;
+  int png_ptr, info_ptr, *end_info;
+  if (!fp)
+    return;
+  if (png_ptr) {
+    info_ptr = 0;
+    end_info = png_set_longjmp_fn();
+  }
+  png_load_body_c.end_info = end_info;
+  png_load_body_c.fp = fp;
+  if (png_ptr)
+    png_set_longjmp_fn();
+  setjmp(info_ptr);
+}
index a2fbbc56bcc2c5cd8e5ce36ad9e3a1ea0657c03f..f36d8d1c6420aac5b6df56afadd604c4bee1a158 100644 (file)
@@ -4214,6 +4214,15 @@ vect_slp_function (function *fun)
        }
       else
        bbs.safe_push (bb);
+
+      /* When we have a stmt ending this block we have to insert on
+        edges when inserting after it.  Avoid this for now.  */
+      if (gimple *last = last_stmt (bb))
+       if (is_ctrl_altering_stmt (last))
+         {
+           r |= vect_slp_bbs (bbs);
+           bbs.truncate (0);
+         }
     }
 
   if (!bbs.is_empty ())