]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix PR94443 with gsi_insert_seq_before [PR94443]
authorKewen Lin <linkw@linux.ibm.com>
Fri, 3 Apr 2020 07:10:08 +0000 (02:10 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Fri, 17 Apr 2020 07:51:40 +0000 (02:51 -0500)
This patch is to fix the stupid mistake by using
gsi_insert_seq_before instead of gsi_insert_before.

BTW, the regression testing on one x86_64 machine from CFarm is
unable to reveal it (I guess due to native arch sandybridge?), so I
specified additional option -march=znver2 and verified the coverage.

Bootstrapped/regtested on powerpc64le-linux-gnu (P9) and
x86_64-pc-linux-gnu, also verified the fail cases in related PRs.

Backport from mainline.

  2020-04-03  Kewen Lin  <linkw@gcc.gnu.org>

  gcc/
      PR tree-optimization/94443
      * tree-vect-loop.c (vectorizable_live_operation): Use
      gsi_insert_seq_before to replace gsi_insert_before.

  gcc/testsuite/
      PR tree-optimization/94443
      * gcc.dg/vect/pr94443.c: New test.

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr94443.c [new file with mode: 0644]
gcc/tree-vect-loop.c

index 79c7e50f44bfd7feea481c5d03783d997eae33ff..29f9f52067d46f0cfe2a228af77ae3079961db15 100644 (file)
@@ -1,3 +1,12 @@
+2020-04-17  Kewen Lin  <linkw@gcc.gnu.org>
+
+       Backport from mainline
+       2020-04-03  Kewen Lin  <linkw@gcc.gnu.org>
+
+       PR tree-optimization/94443
+       * tree-vect-loop.c (vectorizable_live_operation): Use
+       gsi_insert_seq_before to replace gsi_insert_before.
+
 2020-04-17  Kewen Lin  <linkw@gcc.gnu.org>
 
        Backport from mainline
index 09443adbbd8a3a0b01914317755546d21959b52d..8742d27ce2f4b63a40176f678c16a24ed352aa4a 100644 (file)
@@ -1,3 +1,11 @@
+2020-04-17  Kewen Lin  <linkw@gcc.gnu.org>
+
+       Backport from mainline
+       2020-04-03  Kewen Lin  <linkw@gcc.gnu.org>
+
+       PR tree-optimization/94443
+       * gcc.dg/vect/pr94443.c: New test.
+
 2020-04-17  Kewen Lin  <linkw@gcc.gnu.org>
 
        Backport from mainline
diff --git a/gcc/testsuite/gcc.dg/vect/pr94443.c b/gcc/testsuite/gcc.dg/vect/pr94443.c
new file mode 100644 (file)
index 0000000..f8cbaf1
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=znver2" { target { x86_64-*-* i?86-*-* } } } */
+
+/* Check it to be compiled successfully without any ICE.  */
+
+int a;
+unsigned *b;
+
+void foo()
+{
+  for (unsigned i; i <= a; ++i, ++b)
+    ;
+}
index 67bdd2e3fc60727e3a5b7782e834fbfa2485c04f..ed6586753c53dd13741cb8612ebf07d383102a32 100644 (file)
@@ -7994,7 +7994,7 @@ vectorizable_live_operation (stmt_vec_info stmt_info,
   if (stmts)
     {
       gimple_stmt_iterator exit_gsi = gsi_after_labels (exit_bb);
-      gsi_insert_before (&exit_gsi, stmts, GSI_CONTINUE_LINKING);
+      gsi_insert_seq_before (&exit_gsi, stmts, GSI_SAME_STMT);
 
       /* Remove existing phi from lhs and create one copy from new_tree.  */
       tree lhs_phi = NULL_TREE;
@@ -8007,7 +8007,7 @@ vectorizable_live_operation (stmt_vec_info stmt_info,
              remove_phi_node (&gsi, false);
              lhs_phi = gimple_phi_result (phi);
              gimple *copy = gimple_build_assign (lhs_phi, new_tree);
-             gsi_insert_after (&exit_gsi, copy, GSI_CONTINUE_LINKING);
+             gsi_insert_before (&exit_gsi, copy, GSI_SAME_STMT);
              break;
            }
        }