• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -polly-scops -analyze < %s | FileCheck %s
2;
3; CHECK:      Statements {
4; CHECK-NEXT:     Stmt_for_body
5; CHECK-NEXT:         Domain :=
6; CHECK-NEXT:             [N] -> { Stmt_for_body[i0] : 0 <= i0 < N };
7; CHECK-NEXT:         Schedule :=
8; CHECK-NEXT:             [N] -> { Stmt_for_body[i0] -> [i0] };
9; CHECK-NEXT:         ReadAccess :=    [Reduction Type: NONE] [Scalar: 0]
10; CHECK-NEXT:             [N] -> { Stmt_for_body[i0] -> MemRef_A[o0] : -4 + N + 5i0 <= 5o0 <= N + 5i0 };
11; CHECK-NEXT:         ReadAccess :=    [Reduction Type: NONE] [Scalar: 0]
12; CHECK-NEXT:             [N] -> { Stmt_for_body[i0] -> MemRef_A[o0] : -N + 5i0 <= 5o0 <= 4 - N + 5i0 };
13; CHECK-NEXT:         MustWriteAccess :=    [Reduction Type: NONE] [Scalar: 0]
14; CHECK-NEXT:             [N] -> { Stmt_for_body[i0] -> MemRef_A[i0] };
15; CHECK-NEXT: }
16;
17;    void f(int *A, int N) {
18;      for (int i = 0; i < N; i++)
19;        A[i] = A[i + (N / 5)] + A[i + (N / -5)];
20;    }
21;
22target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
23
24define void @f(i32* %A, i32 %N) {
25entry:
26  %tmp = sext i32 %N to i64
27  br label %for.cond
28
29for.cond:                                         ; preds = %for.inc, %entry
30  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
31  %cmp = icmp slt i64 %indvars.iv, %tmp
32  br i1 %cmp, label %for.body, label %for.end
33
34for.body:                                         ; preds = %for.cond
35  %div = sdiv i32 %N, 5
36  %tmp1 = trunc i64 %indvars.iv to i32
37  %add = add nsw i32 %tmp1, %div
38  %idxprom = sext i32 %add to i64
39  %arrayidx = getelementptr inbounds i32, i32* %A, i64 %idxprom
40  %tmp2 = load i32, i32* %arrayidx, align 4
41  %div1 = sdiv i32 %N, -5
42  %tmp3 = trunc i64 %indvars.iv to i32
43  %add2 = add nsw i32 %tmp3, %div1
44  %idxprom3 = sext i32 %add2 to i64
45  %arrayidx4 = getelementptr inbounds i32, i32* %A, i64 %idxprom3
46  %tmp4 = load i32, i32* %arrayidx4, align 4
47  %add5 = add nsw i32 %tmp2, %tmp4
48  %arrayidx7 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
49  store i32 %add5, i32* %arrayidx7, align 4
50  br label %for.inc
51
52for.inc:                                          ; preds = %for.body
53  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
54  br label %for.cond
55
56for.end:                                          ; preds = %for.cond
57  ret void
58}
59