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:   { Stmt_if_end[i0] : 0 <= i0 <= 1024 };
11;
12;    void f(int *A) {
13;      int i = 0;
14;      do {
15;        if (i > 1024)
16;          break;
17;        A[i] = i;
18;        i++;
19;      } while (i > 0);
20;    }
21;
22target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23
24define void @f(i32* %A) {
25entry:
26  br label %do.body
27
28do.body:                                          ; preds = %do.cond, %entry
29  %indvars.iv = phi i64 [ %indvars.iv.next, %do.cond ], [ 0, %entry ]
30  %cmp = icmp sgt i64 %indvars.iv, 1024
31  br i1 %cmp, label %if.then, label %if.end
32
33if.then:                                          ; preds = %do.body
34  br label %do.end
35
36if.end:                                           ; preds = %do.body
37  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
38  %tmp = trunc i64 %indvars.iv to i32
39  store i32 %tmp, i32* %arrayidx, align 4
40  br label %do.cond
41
42do.cond:                                          ; preds = %if.end
43  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
44  %cmp2 = icmp sgt i64 %indvars.iv.next, 0
45  br i1 %cmp2, label %do.body, label %do.end.loopexit
46
47do.end.loopexit:                                  ; preds = %do.cond
48  br label %do.end
49
50do.end:                                           ; preds = %do.end.loopexit, %if.then
51  ret void
52}
53