1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2;
3; The SCoP contains a loop with multiple exit blocks (BBs after leaving
4; the loop). The current implementation of deriving their domain derives
5; only a common domain for all of the exit blocks. We disabled loops with
6; multiple exit blocks until this is fixed.
7; XFAIL: *
8;
9; CHECK: Domain :=
10; CHECK:   [N, P, Q] -> { Stmt_if_end[i0] : 0 <= i0 <= 1 + Q and i0 < N and (i0 < P or (P < 0 and i0 >= 2 + P)); Stmt_if_end[0] : N > 0 and ((P <= -2 and Q <= -2) or (P > 0 and Q <= -2) or P = -1) };
11;
12;    void f(int *A, int N, int P, int Q) {
13;      for (int i = 0; i < N; i++) {
14;        if (i == P)
15;          break;
16;        A[i]++;
17;        if (i > Q)
18;          break;
19;      }
20;    }
21;
22target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23
24define void @f(i32* %A, i32 %N, i32 %P, i32 %Q) {
25entry:
26  %tmp = sext i32 %N to i64
27  %tmp1 = sext i32 %Q to i64
28  br label %for.cond
29
30for.cond:                                         ; preds = %for.inc, %entry
31  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
32  %cmp = icmp slt i64 %indvars.iv, %tmp
33  br i1 %cmp, label %for.body, label %for.end.loopexit
34
35for.body:                                         ; preds = %for.cond
36  %tmp2 = trunc i64 %indvars.iv to i32
37  %cmp1 = icmp eq i32 %tmp2, %P
38  br i1 %cmp1, label %if.then, label %if.end
39
40if.then:                                          ; preds = %for.body
41  br label %for.end
42
43if.end:                                           ; preds = %for.body
44  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
45  %tmp3 = load i32, i32* %arrayidx, align 4
46  %inc = add nsw i32 %tmp3, 1
47  store i32 %inc, i32* %arrayidx, align 4
48  %cmp2 = icmp sgt i64 %indvars.iv, %tmp1
49  br i1 %cmp2, label %if.then.3, label %if.end.4
50
51if.then.3:                                        ; preds = %if.end
52  br label %for.end
53
54if.end.4:                                         ; preds = %if.end
55  br label %for.inc
56
57for.inc:                                          ; preds = %if.end.4
58  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
59  br label %for.cond
60
61for.end.loopexit:                                 ; preds = %for.cond
62  br label %for.end
63
64for.end:                                          ; preds = %for.end.loopexit, %if.then.3, %if.then
65  ret void
66}
67