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;    void foo(long n, float A[100]) {
10;      for (long j = 0; j < n; j++) {
11;        for (long i = j; i < n; i++) {
12;          if (i < 0)
13;            goto end;
14;
15;          if (i >= 100)
16;            goto end;
17;
18;          A[i] += i;
19;        }
20;      }
21;    end:
22;      return;
23;    }
24;
25; CHECK: Domain :=
26; CHECK:  [n] -> { Stmt_if_end_7[i0, i1] : i0 >= 0 and 0 <= i1 <= 99 - i0 and i1 < n - i0 };
27;
28target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
29
30define void @foo(i64 %n, float* %A) {
31entry:
32  br label %for.cond
33
34for.cond:                                         ; preds = %for.inc.8, %entry
35  %j.0 = phi i64 [ 0, %entry ], [ %inc9, %for.inc.8 ]
36  %cmp = icmp slt i64 %j.0, %n
37  br i1 %cmp, label %for.body, label %for.end.10
38
39for.body:                                         ; preds = %for.cond
40  br label %for.cond.1
41
42for.cond.1:                                       ; preds = %for.inc, %for.body
43  %i.0 = phi i64 [ %j.0, %for.body ], [ %inc, %for.inc ]
44  %cmp2 = icmp slt i64 %i.0, %n
45  br i1 %cmp2, label %for.body.3, label %for.end
46
47for.body.3:                                       ; preds = %for.cond.1
48  br i1 false, label %if.then, label %if.end
49
50if.then:                                          ; preds = %for.body.3
51  br label %end
52
53if.end:                                           ; preds = %for.body.3
54  %cmp5 = icmp sgt i64 %i.0, 99
55  br i1 %cmp5, label %if.then.6, label %if.end.7
56
57if.then.6:                                        ; preds = %if.end
58  br label %end
59
60if.end.7:                                         ; preds = %if.end
61  %conv = sitofp i64 %i.0 to float
62  %arrayidx = getelementptr inbounds float, float* %A, i64 %i.0
63  %tmp = load float, float* %arrayidx, align 4
64  %add = fadd float %tmp, %conv
65  store float %add, float* %arrayidx, align 4
66  br label %for.inc
67
68for.inc:                                          ; preds = %if.end.7
69  %inc = add nuw nsw i64 %i.0, 1
70  br label %for.cond.1
71
72for.end:                                          ; preds = %for.cond.1
73  br label %for.inc.8
74
75for.inc.8:                                        ; preds = %for.end
76  %inc9 = add nuw nsw i64 %j.0, 1
77  br label %for.cond
78
79for.end.10:                                       ; preds = %for.cond
80  br label %end
81
82end:                                              ; preds = %for.end.10, %if.then.6, %if.then
83  ret void
84}
85