+2017-12-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/81945
+ * cfgloop.h (FOR_EACH_LOOP_FN): Use FN instead of hardcoding fn.
+ * tree-cfg.c (move_sese_region_to_fn): If any of the loops moved
+ to dest_cfun has orig_loop_num set, either remap it to the new
+ loop number if the loop got moved too, or clear it.
+
2017-12-05 Steve Ellcey <sellcey@cavium.com>
* config/aarch64/thunderx2-t99.md (thunderx2t99_branch): Add trap
(LOOP) = li.next ())
#define FOR_EACH_LOOP_FN(FN, LOOP, FLAGS) \
- for (loop_iterator li(fn, &(LOOP), FLAGS); \
+ for (loop_iterator li(FN, &(LOOP), FLAGS); \
(LOOP); \
(LOOP) = li.next ())
+2017-12-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/81945
+ * gcc.dg/graphite/pr81945.c: New test.
+
2017-12-05 Matthew Gretton-Dann <matthew.gretton-dann@arm.com>
* gcc.c-torture/unsorted/dump-noaddr.x: Generate dump files in
--- /dev/null
+/* PR tree-optimization/81945 */
+/* { dg-do compile { target pthread } } */
+/* { dg-options "-O3 -ftree-parallelize-loops=2 -floop-nest-optimize" } */
+
+unsigned long int v;
+
+void
+foo (int x, int y, long int *a)
+{
+ do
+ {
+ int **b;
+
+ while (y != 0)
+ ;
+ v *= 2;
+ **b = *a;
+ ++x;
+ }
+ while (x < 1);
+}
loops->state = LOOPS_MAY_HAVE_MULTIPLE_LATCHES;
set_loops_for_fn (dest_cfun, loops);
+ vec<loop_p, va_gc> *larray = get_loops (saved_cfun)->copy ();
+
/* Move the outlined loop tree part. */
num_nodes = bbs.length ();
FOR_EACH_VEC_ELT (bbs, i, bb)
loop->aux = current_loops->tree_root;
loop0->aux = current_loops->tree_root;
+ /* Fix up orig_loop_num. If the block referenced in it has been moved
+ to dest_cfun, update orig_loop_num field, otherwise clear it. */
+ struct loop *dloop;
+ FOR_EACH_LOOP_FN (dest_cfun, dloop, 0)
+ if (dloop->orig_loop_num)
+ {
+ if ((*larray)[dloop->orig_loop_num] != NULL
+ && get_loop (saved_cfun, dloop->orig_loop_num) == NULL)
+ dloop->orig_loop_num = (*larray)[dloop->orig_loop_num]->num;
+ else
+ dloop->orig_loop_num = 0;
+ }
+ ggc_free (larray);
+
pop_cfun ();
/* Move blocks from BBS into DEST_CFUN. */