tree-optimization/97709 - set abnormal flag when vectorizing live lanes
authorRichard Biener <rguenther@suse.de>
Wed, 4 Nov 2020 10:20:17 +0000 (11:20 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 4 Nov 2020 11:41:14 +0000 (12:41 +0100)
This properly sets the abnormal flag when vectorizing live lanes
when the original scalar was live across an abnormal edge.

2020-11-04  Richard Biener  <rguenther@suse.de>

PR tree-optimization/97709
* tree-vect-loop.c (vectorizable_live_operation): Set
SSA_NAME_OCCURS_IN_ABNORMAL_PHI when necessary.

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

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

diff --git a/gcc/testsuite/gcc.dg/vect/bb-slp-pr97709.c b/gcc/testsuite/gcc.dg/vect/bb-slp-pr97709.c
new file mode 100644 (file)
index 0000000..672807f
--- /dev/null
@@ -0,0 +1,26 @@
+/* { dg-do compile } */
+
+int a;
+struct b {
+  int c;
+  int d;
+};
+void k (struct b);
+struct b
+e()
+{
+  void *f[] = {&&g, &&h, &&i, &&j};
+  int d, c;
+j:
+  goto *a;
+g:
+  d = 0;
+h:
+  c = 1;
+  goto *a;
+i:
+  {
+    struct b b = {c, d};
+    k(b);
+  }
+}
index c09aa39..6cb2286 100644 (file)
@@ -8568,6 +8568,9 @@ vectorizable_live_operation (vec_info *vinfo,
       gimple_seq stmts = NULL;
       new_tree = force_gimple_operand (fold_convert (lhs_type, new_tree),
                                       &stmts, true, NULL_TREE);
+      if (TREE_CODE (new_tree) == SSA_NAME
+         && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs))
+       SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_tree) = 1;
       if (is_a <gphi *> (vec_stmt))
        {
          gimple_stmt_iterator si = gsi_after_labels (gimple_bb (vec_stmt));