]> gcc.gnu.org Git - gcc.git/commitdiff
backport: re PR tree-optimization/89278 (ICE in gimplify_modify_expr, at gimplify...
authorJakub Jelinek <jakub@redhat.com>
Fri, 30 Aug 2019 12:02:02 +0000 (14:02 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 30 Aug 2019 12:02:02 +0000 (14:02 +0200)
Backported from mainline
2019-02-15  Richard Biener  <rguenther@suse.de>
    Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/89278
* tree-loop-distribution.c: Include tree-eh.h.
(generate_memset_builtin, generate_memcpy_builtin): Call
rewrite_to_non_trapping_overflow on builtin->size before passing it
to force_gimple_operand_gsi.

* gcc.dg/pr89278.c: New test.

From-SVN: r275113

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

index d00c11b5d6b6b17aa3c41c3168a9935dc19478cf..4bec5f5c6e643dc3eef0fe7500149fd11f3f9cfb 100644 (file)
@@ -1,6 +1,15 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-02-15  Richard Biener  <rguenther@suse.de>
+                   Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/89278
+       * tree-loop-distribution.c: Include tree-eh.h.
+       (generate_memset_builtin, generate_memcpy_builtin): Call
+       rewrite_to_non_trapping_overflow on builtin->size before passing it
+       to force_gimple_operand_gsi.
+
        2019-02-15  Jakub Jelinek  <jakub@redhat.com>
 
        PR other/89342
index c83e4bfd021c67bb36eaeea840700edfd3bfac57..86a8d1c412f129e37e363e5a8fead12d50a9c1a9 100644 (file)
@@ -1,6 +1,12 @@
 2019-08-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2019-02-15  Richard Biener  <rguenther@suse.de>
+                   Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/89278
+       * gcc.dg/pr89278.c: New test.
+
        2019-02-15  Jakub Jelinek  <jakub@redhat.com>
 
        PR other/89342
diff --git a/gcc/testsuite/gcc.dg/pr89278.c b/gcc/testsuite/gcc.dg/pr89278.c
new file mode 100644 (file)
index 0000000..609cb1a
--- /dev/null
@@ -0,0 +1,23 @@
+/* PR tree-optimization/89278 */
+/* { dg-do compile } */
+/* { dg-options "-O1 -ftrapv -ftree-loop-distribute-patterns --param max-loop-header-insns=2" } */
+
+void
+foo (int *w, int x, int y, int z)
+{
+  while (x < y + z)
+    {
+      w[x] = 0;
+      ++x;
+    }
+}
+
+void
+bar (int *__restrict u, int *__restrict w, int x, int y, int z)
+{
+  while (x < y + z)
+    {
+      w[x] = u[x];
+      ++x;
+    }
+}
index 1b9950eca8ee9ffebe91da58c2529abb09c9f5c5..c8e9db81448b0f74b13baf6adcfd34ea285b702a 100644 (file)
@@ -64,6 +64,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "cfgloop.h"
 #include "tree-scalar-evolution.h"
 #include "tree-vectorizer.h"
+#include "tree-eh.h"
 
 
 /* A Reduced Dependence Graph (RDG) vertex representing a statement.  */
@@ -815,6 +816,7 @@ generate_memset_builtin (struct loop *loop, partition *partition)
 
   nb_bytes = build_size_arg_loc (loc, partition->main_dr, partition->niter,
                                 partition->plus_one);
+  nb_bytes = rewrite_to_non_trapping_overflow (nb_bytes);
   nb_bytes = force_gimple_operand_gsi (&gsi, nb_bytes, true, NULL_TREE,
                                       false, GSI_CONTINUE_LINKING);
   mem = build_addr_arg_loc (loc, partition->main_dr, nb_bytes);
@@ -871,6 +873,7 @@ generate_memcpy_builtin (struct loop *loop, partition *partition)
 
   nb_bytes = build_size_arg_loc (loc, partition->main_dr, partition->niter,
                                 partition->plus_one);
+  nb_bytes = rewrite_to_non_trapping_overflow (nb_bytes);
   nb_bytes = force_gimple_operand_gsi (&gsi, nb_bytes, true, NULL_TREE,
                                       false, GSI_CONTINUE_LINKING);
   dest = build_addr_arg_loc (loc, partition->main_dr, nb_bytes);
This page took 0.094824 seconds and 5 git commands to generate.