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:      Statements {
10; CHECK-NEXT:     Stmt_for_body_outer
11; CHECK-NEXT:         Domain :=
12; CHECK-NEXT:             { Stmt_for_body_outer[i0] : 0 <= i0 <= 257 };
13; CHECK-NEXT:         Schedule :=
14; CHECK-NEXT:             { Stmt_for_body_outer[i0] -> [i0, 0, 0, 0] };
15; CHECK-NEXT:         ReadAccess :=    [Reduction Type: NONE] [Scalar: 0]
16; CHECK-NEXT:             { Stmt_for_body_outer[i0] -> MemRef_A[i0] };
17; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 0]
18; CHECK-NEXT:             { Stmt_for_body_outer[i0] -> MemRef_A[i0] };
19; CHECK-NEXT:     Stmt_for_body
20; CHECK-NEXT:         Domain :=
21; CHECK-NEXT:             { Stmt_for_body[257, i1] : 0 <= i1 <= 1025; Stmt_for_body[i0, 0] : 0 <= i0 <= 256 };
22; CHECK-NEXT:         Schedule :=
23; CHECK-NEXT:             { Stmt_for_body[257, i1] -> [257, 1, i1, 0]; Stmt_for_body[i0, 0] -> [i0, 1, 0, 0] : i0 <= 256 };
24; CHECK-NEXT:         ReadAccess :=    [Reduction Type: NONE] [Scalar: 0]
25; CHECK-NEXT:             { Stmt_for_body[i0, i1] -> MemRef_A[i1] };
26; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 0]
27; CHECK-NEXT:             { Stmt_for_body[i0, i1] -> MemRef_A[i1] };
28; CHECK-NEXT:     Stmt_for_inc
29; CHECK-NEXT:         Domain :=
30; CHECK-NEXT:             { Stmt_for_inc[257, i1] : 0 <= i1 <= 1025 };
31; CHECK-NEXT:         Schedule :=
32; CHECK-NEXT:             { Stmt_for_inc[i0, i1] -> [257, 1, i1, 1] };
33; CHECK-NEXT:         ReadAccess :=    [Reduction Type: NONE] [Scalar: 0]
34; CHECK-NEXT:             { Stmt_for_inc[i0, i1] -> MemRef_A[i1] };
35; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 0]
36; CHECK-NEXT:             { Stmt_for_inc[i0, i1] -> MemRef_A[i1] };
37; CHECK-NEXT: }
38
39target datalayout = "e-m:e-i64:64-i128:128-n8:16:32:64-S128"
40
41define void @foo(i32* %A) {
42entry:
43  br label %for.body.outer
44
45for.body.outer:                                   ; preds = %for.body, %entry
46  %indvar = phi i32 [0, %entry], [%indvar.next, %for.body]
47  %addr = getelementptr i32, i32* %A, i32 %indvar
48  %val = load i32, i32* %addr
49  %indvar.next = add i32 %indvar, 1
50  store i32 %val, i32* %addr
51  br label %for.body
52
53for.body:                                         ; preds = %for.inc, %for.body.outer
54  %indvar.2 = phi i32 [0, %for.body.outer], [%indvar.2.next, %for.inc]
55  %addr.2 = getelementptr i32, i32* %A, i32 %indvar.2
56  %val.2  = load i32, i32* %addr.2
57  %indvar.2.next = add i32 %indvar.2, 1
58  store i32 %val.2, i32* %addr.2
59  %cond.1 = icmp sle i32 %indvar, 256
60  br i1 %cond.1, label %for.body.outer, label %for.inc
61
62for.inc:                                          ; preds = %for.body
63  %addr.3 = getelementptr i32, i32* %A, i32 %indvar.2
64  %val.3  = load i32, i32* %addr.3
65  store i32 %val.3, i32* %addr.3
66  %cond = icmp sle i32 %indvar.2, 1024
67  br i1 %cond, label %for.body, label %for.end
68
69for.end:                                          ; preds = %for.inc
70  ret void
71}
72