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
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
--- /dev/null
+/* 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;
+ }
+}
#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. */
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);
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);