236
|
1 ; RUN: opt %loadPolly -polly-print-scops -disable-output < %s | FileCheck %s
|
150
|
2 ;
|
|
3 ; Test comes from a bug (15771) or better a feature request. It was not allowed
|
|
4 ; in Polly in the old domain generation as ScalarEvolution cannot figure out the
|
|
5 ; loop bounds. However, the new domain generation will detect the SCoP.
|
|
6
|
|
7 ; CHECK: Context:
|
|
8 ; CHECK-NEXT: [n] -> { : -2147483648 <= n <= 2147483647 }
|
|
9 ;
|
|
10 ; CHECK: p0: %n
|
|
11 ;
|
|
12 ; CHECK: Statements {
|
|
13 ; CHECK-NEXT: Stmt_for_next
|
|
14 ; CHECK-NEXT: Domain :=
|
|
15 ; CHECK-NEXT: [n] -> { Stmt_for_next[i0] : i0 >= 0 and 2i0 <= -3 + n };
|
|
16 ; CHECK-NEXT: Schedule :=
|
|
17 ; CHECK-NEXT: [n] -> { Stmt_for_next[i0] -> [i0] };
|
|
18 ; CHECK-NEXT: ReadAccess := [Reduction Type: +] [Scalar: 0]
|
|
19 ; CHECK-NEXT: [n] -> { Stmt_for_next[i0] -> MemRef_A[i0] };
|
|
20 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: +] [Scalar: 0]
|
|
21 ; CHECK-NEXT: [n] -> { Stmt_for_next[i0] -> MemRef_A[i0] };
|
|
22 ; CHECK-NEXT: }
|
|
23
|
|
24 @A = common global [100 x i32] zeroinitializer, align 16
|
|
25
|
|
26 define void @foo(i32 %n) #0 {
|
|
27 entry:
|
|
28 br label %entry.split
|
|
29
|
|
30 entry.split: ; preds = %entry
|
|
31 %cmp2 = icmp sgt i32 %n, 0
|
|
32 br i1 %cmp2, label %for.body.lr.ph, label %for.end
|
|
33
|
|
34 for.body.lr.ph: ; preds = %entry.split
|
|
35 br label %for.body
|
|
36
|
|
37 for.body: ; preds = %for.body.lr.ph, %for.body
|
|
38 %indvar = phi i64 [ 0, %for.body.lr.ph ], [ %indvar.next, %for.next ]
|
252
|
39 %arrayidx = getelementptr [100 x i32], ptr @A, i64 0, i64 %indvar
|
150
|
40 %0 = mul i64 %indvar, 2
|
|
41 %1 = add i64 %0, 2
|
|
42 %add1 = trunc i64 %1 to i32
|
|
43 %cmp = icmp slt i32 %add1, %n
|
|
44 %indvar.next = add i64 %indvar, 1
|
|
45 br i1 %cmp, label %for.next, label %for.cond.for.end_crit_edge
|
|
46
|
|
47 for.next:
|
252
|
48 %2 = load i32, ptr %arrayidx, align 4
|
150
|
49 %add = add nsw i32 %2, 1
|
252
|
50 store i32 %add, ptr %arrayidx, align 4
|
150
|
51 br label %for.body
|
|
52
|
|
53 for.cond.for.end_crit_edge: ; preds = %for.body
|
|
54 br label %for.end
|
|
55
|
|
56 for.end: ; preds = %for.cond.for.end_crit_edge, %entry.split
|
|
57 ret void
|
|
58 }
|