[ForwardOpTree] Allow out-of-quota in examination part of forwardTree.
[polly-mirror.git] / test / ScopDetectionDiagnostics / ReportMultipleNonAffineAccesses.ll
blob2fc2fca0f1e63bf0925d42885d85b4a62fdfc0b4
1 ; RUN: opt %loadPolly -basicaa -pass-remarks-missed="polly-detect" -polly-detect-track-failures -polly-detect -analyze < %s 2>&1| FileCheck %s
2 ; RUN: opt %loadPolly -basicaa -pass-remarks-missed="polly-detect" -polly-detect-track-failures -polly-detect -polly-delinearize=false -polly-detect-keep-going -analyze < %s 2>&1| FileCheck %s -check-prefix=ALL
3 ; RUN: opt %loadPolly -basicaa -pass-remarks-missed="polly-detect" -polly-detect-track-failures -polly-detect -analyze < %s 2>&1| FileCheck %s -check-prefix=DELIN
4 ; RUN: opt %loadPolly -basicaa -pass-remarks-missed="polly-detect" -polly-detect-track-failures -polly-detect -polly-detect-keep-going -analyze < %s 2>&1| FileCheck %s -check-prefix=DELIN-ALL
5 ; RUN: opt %loadPolly -basicaa -pass-remarks-missed="polly-detect" -polly-detect-track-failures -polly-detect -polly-allow-nonaffine -analyze < %s 2>&1| FileCheck %s -check-prefix=NONAFFINE
6 ; RUN: opt %loadPolly -basicaa -pass-remarks-missed="polly-detect" -polly-detect-track-failures -polly-detect -polly-allow-nonaffine -analyze < %s 2>&1| FileCheck %s -check-prefix=NONAFFINE
8 ;  1 void manyaccesses(float A[restrict], long n, float B[restrict][n])
9 ;  2 {
10 ;  3   for (long i = 0; i < 1024; ++i) {
11 ;  4     float a1 = A[2 * i * i];
12 ;  5     float a2 = A[2 * i * i + 1];
13 ;  6     float b1 = B[0][0];
14 ;  7     float b2 = B[i][i];
15 ;  8     float b3 = B[i * i][i];
16 ;  9     float b4 = B[i][0];
17 ; 10     float b5 = B[0][i];
18 ; 11     float b6 = B[0][i*i];
19 ; 12
20 ; 13     A[i * i] = a1 + a2 + b1 + b2 + b3 + b4 + b5 + b6;
21 ; 14   }
22 ; 15 }
24 ; CHECK: remark: /tmp/test.c:3:20: The following errors keep this region from being a Scop.
25 ; CHECK-NEXT: remark: /tmp/test.c:4:16: The array subscript of "A" is not affine
26 ; CHECK-NEXT: remark: /tmp/test.c:13:51: Invalid Scop candidate ends here.
28 ; ALL: remark: /tmp/test.c:3:20: The following errors keep this region from being a Scop.
29 ; ALL-NEXT: remark: /tmp/test.c:4:16: The array subscript of "A" is not affine
30 ; ALL-NEXT: remark: /tmp/test.c:5:16: The array subscript of "A" is not affine
31 ; -> B[0][0] is affine
32 ; ALL-NEXT: remark: /tmp/test.c:7:16: The array subscript of "B" is not affine
33 ; ALL-NEXT: remark: /tmp/test.c:8:16: The array subscript of "B" is not affine
34 ; ALL-NEXT: remark: /tmp/test.c:9:16: The array subscript of "B" is not affine
35 ; -> B[0][i] is affine
36 ; ALL-NEXT: remark: /tmp/test.c:11:16: The array subscript of "B" is not affine
37 ; ALL-NEXT: remark: /tmp/test.c:13:5: The array subscript of "A" is not affine
38 ; ALL-NEXT: remark: /tmp/test.c:13:51: Invalid Scop candidate ends here.
40 ; DELIN: remark: /tmp/test.c:3:20: The following errors keep this region from being a Scop.
41 ; DELIN-NEXT: remark: /tmp/test.c:4:16: The array subscript of "A" is not affine
42 ; DELIN-NEXT: remark: /tmp/test.c:13:51: Invalid Scop candidate ends here.
44 ; DELIN-ALL: remark: /tmp/test.c:3:20: The following errors keep this region from being a Scop.
45 ; DELIN-ALL-NEXT: remark: /tmp/test.c:4:16: The array subscript of "A" is not affine
46 ; DELIN-ALL-NEXT: remark: /tmp/test.c:5:16: The array subscript of "A" is not affine
47 ; DELIN-ALL-NEXT: remark: /tmp/test.c:13:5: The array subscript of "A" is not affine
48 ; -> B[0][0] is affine if delinearized
49 ; -> B[i][i] is affine if delinearized
50 ; DELIN-ALL-NEXT: remark: /tmp/test.c:8:16: The array subscript of "B" is not affine
51 ; -> B[i][0] is affine if delinearized
52 ; -> B[0][i] is affine if delinearized
53 ; DELIN-ALL-NEXT: remark: /tmp/test.c:11:16: The array subscript of "B" is not affine
54 ; DELIN-ALL-NEXT: remark: /tmp/test.c:13:51: Invalid Scop candidate ends here.
56 ; NONAFFINE-NOT: remark: The following errors keep this region from being a Scop.
58 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
60 define void @manyaccesses(float* noalias %A, i64 %n, float* noalias %B) !dbg !4 {
61 entry:
62   br label %entry.split
64 entry.split:                                      ; preds = %entry
65   %tmp = add i64 %n, 1, !dbg !10
66   br label %for.body, !dbg !10
68 for.body:                                         ; preds = %entry.split, %for.body
69   %tmp3 = phi i64 [ 0, %entry.split ], [ %tmp14, %for.body ], !dbg !15
70   %mul = mul i64 %tmp3, 2, !dbg !17
71   %tmp4 = mul i64 %tmp, %tmp3, !dbg !18
72   %arrayidx8 = getelementptr float, float* %B, i64 %tmp4, !dbg !19
73   %mul9 = mul i64 %n, %tmp3, !dbg !15
74   %arrayidx12 = getelementptr float, float* %B, i64 %mul9, !dbg !20
75   %arrayidx15 = getelementptr float, float* %B, i64 %tmp3, !dbg !21
76   %mul1 = mul nsw i64 %mul, %tmp3, !dbg !17
77   %arrayidx = getelementptr inbounds float, float* %A, i64 %mul1, !dbg !22
78   %tmp5 = load float, float* %arrayidx, align 4, !dbg !22
79   %mul3 = mul nsw i64 %mul, %tmp3, !dbg !27
80   %add1 = or i64 %mul3, 1, !dbg !27
81   %arrayidx4 = getelementptr inbounds float, float* %A, i64 %add1, !dbg !28
82   %tmp6 = load float, float* %arrayidx4, align 4, !dbg !28
83   %tmp7 = load float, float* %B, align 4, !dbg !29
84   %tmp8 = load float, float* %arrayidx8, align 4, !dbg !19
85   %tmp9 = mul i64 %mul9, %tmp3, !dbg !15
86   %arrayidx10.sum = add i64 %tmp9, %tmp3, !dbg !15
87   %arrayidx11 = getelementptr inbounds float, float* %B, i64 %arrayidx10.sum, !dbg !15
88   %tmp10 = load float, float* %arrayidx11, align 4, !dbg !15
89   %tmp11 = load float, float* %arrayidx12, align 4, !dbg !20
90   %tmp12 = load float, float* %arrayidx15, align 4, !dbg !21
91   %mul16 = mul nsw i64 %tmp3, %tmp3, !dbg !30
92   %arrayidx18 = getelementptr inbounds float, float* %B, i64 %mul16, !dbg !31
93   %tmp13 = load float, float* %arrayidx18, align 4, !dbg !31
94   %add19 = fadd float %tmp5, %tmp6, !dbg !32
95   %add20 = fadd float %add19, %tmp7, !dbg !33
96   %add21 = fadd float %add20, %tmp8, !dbg !34
97   %add22 = fadd float %add21, %tmp10, !dbg !35
98   %add23 = fadd float %add22, %tmp11, !dbg !36
99   %add24 = fadd float %add23, %tmp12, !dbg !37
100   %add25 = fadd float %add24, %tmp13, !dbg !38
101   %mul26 = mul nsw i64 %tmp3, %tmp3, !dbg !39
102   %arrayidx27 = getelementptr inbounds float, float* %A, i64 %mul26, !dbg !40
103   store float %add25, float* %arrayidx27, align 4, !dbg !40
104   %tmp14 = add nsw i64 %tmp3, 1, !dbg !41
105   %exitcond = icmp ne i64 %tmp14, 1024, !dbg !10
106   br i1 %exitcond, label %for.body, label %for.end, !dbg !10
108 for.end:                                          ; preds = %for.body
109   ret void, !dbg !42
112 !llvm.dbg.cu = !{!0}
113 !llvm.module.flags = !{!7, !8}
114 !llvm.ident = !{!9}
116 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.6.0 ", isOptimized: true, emissionKind: 2, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
117 !1 = !DIFile(filename: "/tmp/test.c", directory: "/home/grosser/Projects/polly/git/tools/polly/test")
118 !2 = !{}
119 !4 = distinct !DISubprogram(name: "manyaccesses", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 2, file: !1, scope: !5, type: !6, variables: !2)
120 !5 = !DIFile(filename: "/tmp/test.c", directory: "/home/grosser/Projects/polly/git/tools/polly/test")
121 !6 = !DISubroutineType(types: !2)
122 !7 = !{i32 2, !"Dwarf Version", i32 4}
123 !8 = !{i32 2, !"Debug Info Version", i32 3}
124 !9 = !{!"clang version 3.6.0 "}
125 !10 = !DILocation(line: 3, column: 20, scope: !11)
126 !11 = !DILexicalBlockFile(discriminator: 2, file: !1, scope: !12)
127 !12 = !DILexicalBlockFile(discriminator: 1, file: !1, scope: !13)
128 !13 = distinct !DILexicalBlock(line: 3, column: 3, file: !1, scope: !14)
129 !14 = distinct !DILexicalBlock(line: 3, column: 3, file: !1, scope: !4)
130 !15 = !DILocation(line: 8, column: 16, scope: !16)
131 !16 = distinct !DILexicalBlock(line: 3, column: 35, file: !1, scope: !13)
132 !17 = !DILocation(line: 4, column: 26, scope: !16)
133 !18 = !DILocation(line: 4, column: 22, scope: !16)
134 !19 = !DILocation(line: 7, column: 16, scope: !16)
135 !20 = !DILocation(line: 9, column: 16, scope: !16)
136 !21 = !DILocation(line: 10, column: 16, scope: !16)
137 !22 = !DILocation(line: 4, column: 16, scope: !16)
138 !27 = !DILocation(line: 5, column: 26, scope: !16)
139 !28 = !DILocation(line: 5, column: 16, scope: !16)
140 !29 = !DILocation(line: 6, column: 16, scope: !16)
141 !30 = !DILocation(line: 11, column: 23, scope: !16) ; [ DW_TAG_lexical_block ] [/]
142 !31 = !DILocation(line: 11, column: 16, scope: !16) ; [ DW_TAG_lexical_block ] [/]
143 !32 = !DILocation(line: 13, column: 21, scope: !16)
144 !33 = !DILocation(line: 13, column: 26, scope: !16)
145 !34 = !DILocation(line: 13, column: 31, scope: !16)
146 !35 = !DILocation(line: 13, column: 36, scope: !16)
147 !36 = !DILocation(line: 13, column: 41, scope: !16)
148 !37 = !DILocation(line: 13, column: 46, scope: !16)
149 !38 = !DILocation(line: 13, column: 51, scope: !16)
150 !39 = !DILocation(line: 13, column: 11, scope: !16)
151 !40 = !DILocation(line: 13, column: 5, scope: !16)
152 !41 = !DILocation(line: 3, column: 30, scope: !13)
153 !42 = !DILocation(line: 15, column: 1, scope: !4)