• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt %loadPolly -basic-aa -polly-scops \
2; RUN:     -polly-allow-nonaffine -polly-allow-nonaffine-branches \
3; RUN:     -polly-allow-nonaffine-loops=true -analyze < %s | FileCheck %s \
4; RUN:     -check-prefix=SCALAR
5; RUN: opt %loadPolly -basic-aa -polly-scops -polly-allow-nonaffine \
6; RUN:     -polly-process-unprofitable=false \
7; RUN:     -polly-allow-nonaffine-branches -polly-allow-nonaffine-loops=true \
8; RUN:     -analyze < %s | FileCheck %s -check-prefix=PROFIT
9;
10; SCALAR:      Function: f
11; SCALAR-NEXT: Region: %bb1---%bb13
12; SCALAR-NEXT: Max Loop Depth:  1
13; SCALAR-NEXT: Invariant Accesses: {
14; SCALAR-NEXT: }
15; SCALAR-NEXT: Context:
16; SCALAR-NEXT: {  :  }
17; SCALAR-NEXT: Assumed Context:
18; SCALAR-NEXT: {  :  }
19; SCALAR-NEXT: Invalid Context:
20; SCALAR-NEXT: {  : false }
21; SCALAR-NEXT: Arrays {
22; SCALAR-NEXT:     i32 MemRef_C[*]; // Element size 4
23; SCALAR-NEXT:     i32 MemRef_A[*]; // Element size 4
24; SCALAR-NEXT: }
25; SCALAR-NEXT: Arrays (Bounds as pw_affs) {
26; SCALAR-NEXT:     i32 MemRef_C[*]; // Element size 4
27; SCALAR-NEXT:     i32 MemRef_A[*]; // Element size 4
28; SCALAR-NEXT: }
29; SCALAR-NEXT: Alias Groups (0):
30; SCALAR-NEXT:     n/a
31; SCALAR-NEXT: Statements {
32; SCALAR-NEXT:     Stmt_bb3__TO__bb11
33; SCALAR-NEXT:         Domain :=
34; SCALAR-NEXT:             { Stmt_bb3__TO__bb11[i0] : 0 <= i0 <= 1023 };
35; SCALAR-NEXT:         Schedule :=
36; SCALAR-NEXT:             { Stmt_bb3__TO__bb11[i0] -> [i0] };
37; SCALAR-NEXT:         ReadAccess :=    [Reduction Type: NONE] [Scalar: 0]
38; SCALAR-NEXT:             { Stmt_bb3__TO__bb11[i0] -> MemRef_C[i0] };
39; SCALAR-NEXT:         ReadAccess :=    [Reduction Type: +] [Scalar: 0]
40; SCALAR-NEXT:             { Stmt_bb3__TO__bb11[i0] -> MemRef_A[o0] };
41; SCALAR-NEXT:         MayWriteAccess :=    [Reduction Type: +] [Scalar: 0]
42; SCALAR-NEXT:             { Stmt_bb3__TO__bb11[i0] -> MemRef_A[o0] };
43; SCALAR-NEXT: }
44
45; PROFIT-NOT: Statements
46;
47;    void f(int * restrict A, int * restrict C) {
48;      int j;
49;      for (int i = 0; i < 1024; i++) {
50;        while ((j = C[i++])) {
51;          A[j]++;
52;          if (true) break;
53;        }
54;      }
55;    }
56;
57target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
58
59define void @f(i32* noalias %A, i32* noalias %C) {
60bb:
61  br label %bb1
62
63bb1:                                              ; preds = %bb12, %bb
64  %indvars.iv = phi i64 [ %indvars.iv.next, %bb12 ], [ 0, %bb ]
65  %exitcond = icmp ne i64 %indvars.iv, 1024
66  br i1 %exitcond, label %bb2, label %bb13
67
68bb2:                                              ; preds = %bb1
69  br label %bb3
70
71bb3:                                              ; preds = %bb6, %bb2
72  %tmp = getelementptr inbounds i32, i32* %C, i64 %indvars.iv
73  %tmp4 = load i32, i32* %tmp, align 4
74  %tmp5 = icmp eq i32 %tmp4, 0
75  br i1 %tmp5, label %bb11, label %bb6
76
77bb6:                                              ; preds = %bb3
78  %tmp7 = sext i32 %tmp4 to i64
79  %tmp8 = getelementptr inbounds i32, i32* %A, i64 %tmp7
80  %tmp9 = load i32, i32* %tmp8, align 4
81  %tmp10 = add nsw i32 %tmp9, 1
82  store i32 %tmp10, i32* %tmp8, align 4
83  br i1 true, label %bb11, label %bb3
84
85bb11:                                             ; preds = %bb3
86  br label %bb12
87
88bb12:                                             ; preds = %bb11
89  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
90  br label %bb1
91
92bb13:                                             ; preds = %bb1
93  ret void
94}
95