===================================================================
@@ -905,7 +905,9 @@ scop_detection::build_scop_breadth (sese
sese_l combined = merge_sese (s1, s2);
- if (combined)
+ if (combined
+ && loop_is_valid_in_scop (loop, combined)
+ && loop_is_valid_in_scop (loop->next, combined))
s1 = combined;
else
add_scop (s2);
@@ -931,6 +933,8 @@ scop_detection::can_represent_loop_1 (lo
&& niter_desc.control.no_overflow
&& (niter = number_of_latch_executions (loop))
&& !chrec_contains_undetermined (niter)
+ && !chrec_contains_undetermined (scalar_evolution_in_region (scop,
+ loop, niter))
&& graphite_can_represent_expr (scop, loop, niter);
}
===================================================================
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -floop-nest-optimize" } */
+
+int a, b, d;
+int **c;
+int fn1() {
+ while (a)
+ if (d) {
+ int e = -d;
+ for (; b < e; b++)
+ c[b] = &a;
+ } else {
+ for (; b; b++)
+ c[b] = &b;
+ d = 0;
+ }
+}