blob: ff44f99d2ba5ca165c2cd8ca5eda675b0ba9892b [file] [log] [blame]
Alexey Bataevdb390212015-05-20 04:24:19 +00001// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
2// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
3// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
4// RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -fexceptions -fcxx-exceptions -gline-tables-only -x c++ -emit-llvm %s -o - | FileCheck %s --check-prefix=TERM_DEBUG
Adrian Prantlcbc368c2015-02-25 02:44:04 +00005//
Alexander Musmana5f070a2014-10-01 06:03:56 +00006// expected-no-diagnostics
7#ifndef HEADER
8#define HEADER
9
Alexander Musman3276a272015-03-21 10:12:56 +000010long long get_val() { return 0; }
11double *g_ptr;
12
Alexander Musmana5f070a2014-10-01 06:03:56 +000013// CHECK-LABEL: define {{.*void}} @{{.*}}simple{{.*}}(float* {{.+}}, float* {{.+}}, float* {{.+}}, float* {{.+}})
14void simple(float *a, float *b, float *c, float *d) {
15 #pragma omp simd
16// CHECK: store i32 0, i32* [[OMP_IV:%[^,]+]]
17
David Blaikiea953f282015-02-27 21:19:58 +000018// CHECK: [[IV:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID:[0-9]+]]
Alexander Musmana5f070a2014-10-01 06:03:56 +000019// CHECK-NEXT: [[CMP:%.+]] = icmp slt i32 [[IV]], 6
20// CHECK-NEXT: br i1 [[CMP]], label %[[SIMPLE_LOOP1_BODY:.+]], label %[[SIMPLE_LOOP1_END:[^,]+]]
21 for (int i = 3; i < 32; i += 5) {
22// CHECK: [[SIMPLE_LOOP1_BODY]]
23// Start of body: calculate i from IV:
David Blaikiea953f282015-02-27 21:19:58 +000024// CHECK: [[IV1_1:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +000025// CHECK: [[CALC_I_1:%.+]] = mul nsw i32 [[IV1_1]], 5
26// CHECK-NEXT: [[CALC_I_2:%.+]] = add nsw i32 3, [[CALC_I_1]]
27// CHECK-NEXT: store i32 [[CALC_I_2]], i32* [[LC_I:.+]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]]
28// ... loop body ...
29// End of body: store into a[i]:
30// CHECK: store float [[RESULT:%.+]], float* {{%.+}}{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]]
31 a[i] = b[i] * c[i] * d[i];
David Blaikiea953f282015-02-27 21:19:58 +000032// CHECK: [[IV1_2:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +000033// CHECK-NEXT: [[ADD1_2:%.+]] = add nsw i32 [[IV1_2]], 1
34// CHECK-NEXT: store i32 [[ADD1_2]], i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP1_ID]]
35// br label %{{.+}}, !llvm.loop !{{.+}}
36 }
37// CHECK: [[SIMPLE_LOOP1_END]]
38
Alexander Musman3276a272015-03-21 10:12:56 +000039 long long k = get_val();
40
41 #pragma omp simd linear(k : 3)
42// CHECK: [[K0:%.+]] = call {{.*}}i64 @{{.*}}get_val
43// CHECK-NEXT: store i64 [[K0]], i64* [[K_VAR:%[^,]+]]
Alexey Bataevcbdcbb72015-06-17 07:45:51 +000044// CHECK: store i32 0, i32* [[OMP_IV2:%[^,]+]]
Alexander Musman3276a272015-03-21 10:12:56 +000045// CHECK: [[K0LOAD:%.+]] = load i64, i64* [[K_VAR]]
46// CHECK-NEXT: store i64 [[K0LOAD]], i64* [[LIN0:%[^,]+]]
Alexander Musmana5f070a2014-10-01 06:03:56 +000047
David Blaikiea953f282015-02-27 21:19:58 +000048// CHECK: [[IV2:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID:[0-9]+]]
Alexander Musmana5f070a2014-10-01 06:03:56 +000049// CHECK-NEXT: [[CMP2:%.+]] = icmp slt i32 [[IV2]], 9
50// CHECK-NEXT: br i1 [[CMP2]], label %[[SIMPLE_LOOP2_BODY:.+]], label %[[SIMPLE_LOOP2_END:[^,]+]]
51 for (int i = 10; i > 1; i--) {
52// CHECK: [[SIMPLE_LOOP2_BODY]]
53// Start of body: calculate i from IV:
David Blaikiea953f282015-02-27 21:19:58 +000054// CHECK: [[IV2_0:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +000055// FIXME: It is interesting, why the following "mul 1" was not constant folded?
56// CHECK-NEXT: [[IV2_1:%.+]] = mul nsw i32 [[IV2_0]], 1
57// CHECK-NEXT: [[LC_I_1:%.+]] = sub nsw i32 10, [[IV2_1]]
58// CHECK-NEXT: store i32 [[LC_I_1]], i32* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]]
Alexander Musman3276a272015-03-21 10:12:56 +000059//
60// CHECK-NEXT: [[LIN0_1:%.+]] = load i64, i64* [[LIN0]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]]
61// CHECK-NEXT: [[IV2_2:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]]
62// CHECK-NEXT: [[LIN_MUL1:%.+]] = mul nsw i32 [[IV2_2]], 3
63// CHECK-NEXT: [[LIN_EXT1:%.+]] = sext i32 [[LIN_MUL1]] to i64
64// CHECK-NEXT: [[LIN_ADD1:%.+]] = add nsw i64 [[LIN0_1]], [[LIN_EXT1]]
65// Update of the privatized version of linear variable!
66// CHECK-NEXT: store i64 [[LIN_ADD1]], i64* [[K_PRIVATIZED:%[^,]+]]
67 a[k]++;
68 k = k + 3;
David Blaikiea953f282015-02-27 21:19:58 +000069// CHECK: [[IV2_2:%.+]] = load i32, i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +000070// CHECK-NEXT: [[ADD2_2:%.+]] = add nsw i32 [[IV2_2]], 1
71// CHECK-NEXT: store i32 [[ADD2_2]], i32* [[OMP_IV2]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP2_ID]]
72// br label {{.+}}, !llvm.loop ![[SIMPLE_LOOP2_ID]]
73 }
74// CHECK: [[SIMPLE_LOOP2_END]]
Alexander Musman3276a272015-03-21 10:12:56 +000075//
76// Update linear vars after loop, as the loop was operating on a private version.
77// CHECK: [[LIN0_2:%.+]] = load i64, i64* [[LIN0]]
78// CHECK-NEXT: [[LIN_ADD2:%.+]] = add nsw i64 [[LIN0_2]], 27
79// CHECK-NEXT: store i64 [[LIN_ADD2]], i64* [[K_VAR]]
80//
Alexander Musmana5f070a2014-10-01 06:03:56 +000081
Alexander Musman3276a272015-03-21 10:12:56 +000082 int lin = 12;
83 #pragma omp simd linear(lin : get_val()), linear(g_ptr)
84
85// Init linear private var.
86// CHECK: store i32 12, i32* [[LIN_VAR:%[^,]+]]
Alexander Musmana5f070a2014-10-01 06:03:56 +000087// CHECK: store i64 0, i64* [[OMP_IV3:%[^,]+]]
88
Alexey Bataevcbdcbb72015-06-17 07:45:51 +000089// CHECK: [[LIN_LOAD:%.+]] = load i32, i32* [[LIN_VAR]]
90// CHECK-NEXT: store i32 [[LIN_LOAD]], i32* [[LIN_START:%[^,]+]]
Alexander Musman3276a272015-03-21 10:12:56 +000091// Remember linear step.
92// CHECK: [[CALL_VAL:%.+]] = invoke
93// CHECK: store i64 [[CALL_VAL]], i64* [[LIN_STEP:%[^,]+]]
94
Alexey Bataevcbdcbb72015-06-17 07:45:51 +000095// CHECK: [[GLIN_LOAD:%.+]] = load double*, double** [[GLIN_VAR:@[^,]+]]
96// CHECK-NEXT: store double* [[GLIN_LOAD]], double** [[GLIN_START:%[^,]+]]
97
David Blaikiea953f282015-02-27 21:19:58 +000098// CHECK: [[IV3:%.+]] = load i64, i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID:[0-9]+]]
Alexander Musmana5f070a2014-10-01 06:03:56 +000099// CHECK-NEXT: [[CMP3:%.+]] = icmp ult i64 [[IV3]], 4
100// CHECK-NEXT: br i1 [[CMP3]], label %[[SIMPLE_LOOP3_BODY:.+]], label %[[SIMPLE_LOOP3_END:[^,]+]]
101 for (unsigned long long it = 2000; it >= 600; it-=400) {
102// CHECK: [[SIMPLE_LOOP3_BODY]]
103// Start of body: calculate it from IV:
David Blaikiea953f282015-02-27 21:19:58 +0000104// CHECK: [[IV3_0:%.+]] = load i64, i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000105// CHECK-NEXT: [[LC_IT_1:%.+]] = mul i64 [[IV3_0]], 400
106// CHECK-NEXT: [[LC_IT_2:%.+]] = sub i64 2000, [[LC_IT_1]]
107// CHECK-NEXT: store i64 [[LC_IT_2]], i64* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
Alexander Musman3276a272015-03-21 10:12:56 +0000108//
109// Linear start and step are used to calculate current value of the linear variable.
110// CHECK: [[LINSTART:.+]] = load i32, i32* [[LIN_START]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
111// CHECK: [[LINSTEP:.+]] = load i64, i64* [[LIN_STEP]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
112// CHECK-NOT: store i32 {{.+}}, i32* [[LIN_VAR]],{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
113// CHECK: [[GLINSTART:.+]] = load double*, double** [[GLIN_START]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
114// CHECK-NEXT: [[IV3_1:%.+]] = load i64, i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
115// CHECK-NEXT: [[MUL:%.+]] = mul i64 [[IV3_1]], 1
Alexander Musman04701242015-03-21 11:49:27 +0000116// CHECK: [[GEP:%.+]] = getelementptr{{.*}}[[GLINSTART]]
Alexander Musman3276a272015-03-21 10:12:56 +0000117// CHECK-NEXT: store double* [[GEP]], double** [[G_PTR_CUR:%[^,]+]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
118 *g_ptr++ = 0.0;
119// CHECK: [[GEP_VAL:%.+]] = load double{{.*}}[[G_PTR_CUR]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
120// CHECK: store double{{.*}}[[GEP_VAL]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
121 a[it + lin]++;
122// CHECK: [[FLT_INC:%.+]] = fadd float
123// CHECK-NEXT: store float [[FLT_INC]],{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
David Blaikiea953f282015-02-27 21:19:58 +0000124// CHECK: [[IV3_2:%.+]] = load i64, i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000125// CHECK-NEXT: [[ADD3_2:%.+]] = add i64 [[IV3_2]], 1
126// CHECK-NEXT: store i64 [[ADD3_2]], i64* [[OMP_IV3]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP3_ID]]
127 }
128// CHECK: [[SIMPLE_LOOP3_END]]
Alexander Musman3276a272015-03-21 10:12:56 +0000129//
130// Linear start and step are used to calculate final value of the linear variables.
131// CHECK: [[LINSTART:.+]] = load i32, i32* [[LIN_START]]
132// CHECK: [[LINSTEP:.+]] = load i64, i64* [[LIN_STEP]]
133// CHECK: store i32 {{.+}}, i32* [[LIN_VAR]],
134// CHECK: [[GLINSTART:.+]] = load double*, double** [[GLIN_START]]
135// CHECK: store double* {{.*}}[[GLIN_VAR]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000136
137 #pragma omp simd
138// CHECK: store i32 0, i32* [[OMP_IV4:%[^,]+]]
139
David Blaikiea953f282015-02-27 21:19:58 +0000140// CHECK: [[IV4:%.+]] = load i32, i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID:[0-9]+]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000141// CHECK-NEXT: [[CMP4:%.+]] = icmp slt i32 [[IV4]], 4
142// CHECK-NEXT: br i1 [[CMP4]], label %[[SIMPLE_LOOP4_BODY:.+]], label %[[SIMPLE_LOOP4_END:[^,]+]]
143 for (short it = 6; it <= 20; it-=-4) {
144// CHECK: [[SIMPLE_LOOP4_BODY]]
145// Start of body: calculate it from IV:
David Blaikiea953f282015-02-27 21:19:58 +0000146// CHECK: [[IV4_0:%.+]] = load i32, i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000147// CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i32 [[IV4_0]], 4
148// CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i32 6, [[LC_IT_1]]
149// CHECK-NEXT: [[LC_IT_3:%.+]] = trunc i32 [[LC_IT_2]] to i16
150// CHECK-NEXT: store i16 [[LC_IT_3]], i16* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]]
151
David Blaikiea953f282015-02-27 21:19:58 +0000152// CHECK: [[IV4_2:%.+]] = load i32, i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000153// CHECK-NEXT: [[ADD4_2:%.+]] = add nsw i32 [[IV4_2]], 1
154// CHECK-NEXT: store i32 [[ADD4_2]], i32* [[OMP_IV4]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP4_ID]]
155 }
156// CHECK: [[SIMPLE_LOOP4_END]]
157
158 #pragma omp simd
159// CHECK: store i32 0, i32* [[OMP_IV5:%[^,]+]]
160
David Blaikiea953f282015-02-27 21:19:58 +0000161// CHECK: [[IV5:%.+]] = load i32, i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID:[0-9]+]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000162// CHECK-NEXT: [[CMP5:%.+]] = icmp slt i32 [[IV5]], 26
163// CHECK-NEXT: br i1 [[CMP5]], label %[[SIMPLE_LOOP5_BODY:.+]], label %[[SIMPLE_LOOP5_END:[^,]+]]
164 for (unsigned char it = 'z'; it >= 'a'; it+=-1) {
165// CHECK: [[SIMPLE_LOOP5_BODY]]
166// Start of body: calculate it from IV:
David Blaikiea953f282015-02-27 21:19:58 +0000167// CHECK: [[IV5_0:%.+]] = load i32, i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000168// CHECK-NEXT: [[IV5_1:%.+]] = mul nsw i32 [[IV5_0]], 1
169// CHECK-NEXT: [[LC_IT_1:%.+]] = sub nsw i32 122, [[IV5_1]]
170// CHECK-NEXT: [[LC_IT_2:%.+]] = trunc i32 [[LC_IT_1]] to i8
171// CHECK-NEXT: store i8 [[LC_IT_2]], i8* {{.+}}, !llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]]
172
David Blaikiea953f282015-02-27 21:19:58 +0000173// CHECK: [[IV5_2:%.+]] = load i32, i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000174// CHECK-NEXT: [[ADD5_2:%.+]] = add nsw i32 [[IV5_2]], 1
175// CHECK-NEXT: store i32 [[ADD5_2]], i32* [[OMP_IV5]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP5_ID]]
176 }
177// CHECK: [[SIMPLE_LOOP5_END]]
178
Alexey Bataev62dbb972015-04-22 11:59:37 +0000179// CHECK-NOT: mul i32 %{{.+}}, 10
Alexander Musmana5f070a2014-10-01 06:03:56 +0000180 #pragma omp simd
Alexey Bataev62dbb972015-04-22 11:59:37 +0000181 for (unsigned i=100; i<10; i+=10) {
Alexander Musmana5f070a2014-10-01 06:03:56 +0000182 }
Alexander Musmana5f070a2014-10-01 06:03:56 +0000183
184 int A;
Alexey Bataevfc087ec2015-06-16 13:14:42 +0000185 // CHECK: store i32 -1, i32* [[A:%.+]],
186 A = -1;
Alexander Musmana5f070a2014-10-01 06:03:56 +0000187 #pragma omp simd lastprivate(A)
Alexander Musmana5f070a2014-10-01 06:03:56 +0000188// CHECK: store i64 0, i64* [[OMP_IV7:%[^,]+]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000189// CHECK: br label %[[SIMD_LOOP7_COND:[^,]+]]
190// CHECK: [[SIMD_LOOP7_COND]]
David Blaikiea953f282015-02-27 21:19:58 +0000191// CHECK-NEXT: [[IV7:%.+]] = load i64, i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID:[0-9]+]]
Alexey Bataevae05c292015-06-16 11:59:36 +0000192// CHECK-NEXT: [[CMP7:%.+]] = icmp slt i64 [[IV7]], 7
Alexander Musmana5f070a2014-10-01 06:03:56 +0000193// CHECK-NEXT: br i1 [[CMP7]], label %[[SIMPLE_LOOP7_BODY:.+]], label %[[SIMPLE_LOOP7_END:[^,]+]]
194 for (long long i = -10; i < 10; i += 3) {
195// CHECK: [[SIMPLE_LOOP7_BODY]]
196// Start of body: calculate i from IV:
David Blaikiea953f282015-02-27 21:19:58 +0000197// CHECK: [[IV7_0:%.+]] = load i64, i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000198// CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i64 [[IV7_0]], 3
199// CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i64 -10, [[LC_IT_1]]
Alexey Bataevfc087ec2015-06-16 13:14:42 +0000200// CHECK-NEXT: store i64 [[LC_IT_2]], i64* [[LC:%[^,]+]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]]
201// CHECK-NEXT: [[LC_VAL:%.+]] = load i64, i64* [[LC]]{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]]
202// CHECK-NEXT: [[CONV:%.+]] = trunc i64 [[LC_VAL]] to i32
203// CHECK-NEXT: store i32 [[CONV]], i32* [[A_PRIV:%[^,]+]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000204 A = i;
David Blaikiea953f282015-02-27 21:19:58 +0000205// CHECK: [[IV7_2:%.+]] = load i64, i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000206// CHECK-NEXT: [[ADD7_2:%.+]] = add nsw i64 [[IV7_2]], 1
207// CHECK-NEXT: store i64 [[ADD7_2]], i64* [[OMP_IV7]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP7_ID]]
208 }
209// CHECK: [[SIMPLE_LOOP7_END]]
Alexey Bataevfc087ec2015-06-16 13:14:42 +0000210// CHECK-NEXT: [[A_PRIV_VAL:%.+]] = load i32, i32* [[A_PRIV]],
211// CHECK-NEXT: store i32 [[A_PRIV_VAL]], i32* [[A]],
Alexey Bataev89e7e8e2015-06-17 06:21:39 +0000212 int R;
213 // CHECK: store i32 -1, i32* [[R:%.+]],
214 R = -1;
215// CHECK: store i64 0, i64* [[OMP_IV8:%[^,]+]]
216// CHECK: store i32 1, i32* [[R_PRIV:%.+]],
217 #pragma omp simd reduction(*:R)
218// CHECK: br label %[[SIMD_LOOP8_COND:[^,]+]]
219// CHECK: [[SIMD_LOOP8_COND]]
220// CHECK-NEXT: [[IV8:%.+]] = load i64, i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID:[0-9]+]]
221// CHECK-NEXT: [[CMP8:%.+]] = icmp slt i64 [[IV8]], 7
222// CHECK-NEXT: br i1 [[CMP8]], label %[[SIMPLE_LOOP8_BODY:.+]], label %[[SIMPLE_LOOP8_END:[^,]+]]
223 for (long long i = -10; i < 10; i += 3) {
224// CHECK: [[SIMPLE_LOOP8_BODY]]
225// Start of body: calculate i from IV:
226// CHECK: [[IV8_0:%.+]] = load i64, i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]]
227// CHECK-NEXT: [[LC_IT_1:%.+]] = mul nsw i64 [[IV8_0]], 3
228// CHECK-NEXT: [[LC_IT_2:%.+]] = add nsw i64 -10, [[LC_IT_1]]
229// CHECK-NEXT: store i64 [[LC_IT_2]], i64* [[LC:%[^,]+]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]]
230// CHECK-NEXT: [[LC_VAL:%.+]] = load i64, i64* [[LC]]{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]]
231// CHECK: store i32 %{{.+}}, i32* [[R_PRIV]],{{.+}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]]
232 R *= i;
233// CHECK: [[IV8_2:%.+]] = load i64, i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]]
234// CHECK-NEXT: [[ADD8_2:%.+]] = add nsw i64 [[IV8_2]], 1
235// CHECK-NEXT: store i64 [[ADD8_2]], i64* [[OMP_IV8]]{{.*}}!llvm.mem.parallel_loop_access ![[SIMPLE_LOOP8_ID]]
236 }
237// CHECK: [[SIMPLE_LOOP8_END]]
238// CHECK-NEXT: [[R_VAL:%.+]] = load i32, i32* [[R]],
239// CHECK-NEXT: [[R_PRIV_VAL:%.+]] = load i32, i32* [[R_PRIV]],
240// CHECK-NEXT: [[RED:%.+]] = mul nsw i32 [[R_VAL]], [[R_PRIV_VAL]]
241// CHECK-NEXT: store i32 [[RED]], i32* [[R]],
Alexey Bataevae05c292015-06-16 11:59:36 +0000242// CHECK-NEXT: ret void
Alexander Musmana5f070a2014-10-01 06:03:56 +0000243}
244
245template <class T, unsigned K> T tfoo(T a) { return a + K; }
246
247template <typename T, unsigned N>
248int templ1(T a, T *z) {
249 #pragma omp simd collapse(N)
250 for (int i = 0; i < N * 2; i++) {
251 for (long long j = 0; j < (N + N + N + N); j += 2) {
252 z[i + j] = a + tfoo<T, N>(i + j);
253 }
254 }
255 return 0;
256}
257
258// Instatiation templ1<float,2>
259// CHECK-LABEL: define {{.*i32}} @{{.*}}templ1{{.*}}(float {{.+}}, float* {{.+}})
260// CHECK: store i64 0, i64* [[T1_OMP_IV:[^,]+]]
261// ...
David Blaikiea953f282015-02-27 21:19:58 +0000262// CHECK: [[IV:%.+]] = load i64, i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID:[0-9]+]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000263// CHECK-NEXT: [[CMP1:%.+]] = icmp slt i64 [[IV]], 16
264// CHECK-NEXT: br i1 [[CMP1]], label %[[T1_BODY:.+]], label %[[T1_END:[^,]+]]
265// CHECK: [[T1_BODY]]
266// Loop counters i and j updates:
David Blaikiea953f282015-02-27 21:19:58 +0000267// CHECK: [[IV1:%.+]] = load i64, i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000268// CHECK-NEXT: [[I_1:%.+]] = sdiv i64 [[IV1]], 4
269// CHECK-NEXT: [[I_1_MUL1:%.+]] = mul nsw i64 [[I_1]], 1
270// CHECK-NEXT: [[I_1_ADD0:%.+]] = add nsw i64 0, [[I_1_MUL1]]
271// CHECK-NEXT: [[I_2:%.+]] = trunc i64 [[I_1_ADD0]] to i32
272// CHECK-NEXT: store i32 [[I_2]], i32* {{%.+}}{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]]
David Blaikiea953f282015-02-27 21:19:58 +0000273// CHECK: [[IV2:%.+]] = load i64, i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000274// CHECK-NEXT: [[J_1:%.+]] = srem i64 [[IV2]], 4
275// CHECK-NEXT: [[J_2:%.+]] = mul nsw i64 [[J_1]], 2
276// CHECK-NEXT: [[J_2_ADD0:%.+]] = add nsw i64 0, [[J_2]]
277// CHECK-NEXT: store i64 [[J_2_ADD0]], i64* {{%.+}}{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]]
278// simd.for.inc:
David Blaikiea953f282015-02-27 21:19:58 +0000279// CHECK: [[IV3:%.+]] = load i64, i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000280// CHECK-NEXT: [[INC:%.+]] = add nsw i64 [[IV3]], 1
281// CHECK-NEXT: store i64 [[INC]], i64* [[T1_OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[T1_ID]]
282// CHECK-NEXT: br label {{%.+}}
283// CHECK: [[T1_END]]
284// CHECK: ret i32 0
285//
286void inst_templ1() {
287 float a;
288 float z[100];
289 templ1<float,2> (a, z);
290}
291
292
293typedef int MyIdx;
294
295class IterDouble {
296 double *Ptr;
297public:
298 IterDouble operator++ () const {
299 IterDouble n;
300 n.Ptr = Ptr + 1;
301 return n;
302 }
303 bool operator < (const IterDouble &that) const {
304 return Ptr < that.Ptr;
305 }
306 double & operator *() const {
307 return *Ptr;
308 }
309 MyIdx operator - (const IterDouble &that) const {
310 return (MyIdx) (Ptr - that.Ptr);
311 }
312 IterDouble operator + (int Delta) {
313 IterDouble re;
314 re.Ptr = Ptr + Delta;
315 return re;
316 }
317
318 ///~IterDouble() {}
319};
320
321// CHECK-LABEL: define {{.*void}} @{{.*}}iter_simple{{.*}}
322void iter_simple(IterDouble ia, IterDouble ib, IterDouble ic) {
323//
324// CHECK: store i32 0, i32* [[IT_OMP_IV:%[^,]+]]
325// Calculate number of iterations before the loop body.
Alexey Bataev36bf0112015-03-10 05:15:26 +0000326// CHECK: [[DIFF1:%.+]] = invoke {{.*}}i32 @{{.*}}IterDouble{{.*}}
327// CHECK: [[DIFF2:%.+]] = sub nsw i32 [[DIFF1]], 1
Alexander Musmana5f070a2014-10-01 06:03:56 +0000328// CHECK-NEXT: [[DIFF3:%.+]] = add nsw i32 [[DIFF2]], 1
329// CHECK-NEXT: [[DIFF4:%.+]] = sdiv i32 [[DIFF3]], 1
330// CHECK-NEXT: [[DIFF5:%.+]] = sub nsw i32 [[DIFF4]], 1
331// CHECK-NEXT: store i32 [[DIFF5]], i32* [[OMP_LAST_IT:%[^,]+]]{{.+}}
332 #pragma omp simd
333
David Blaikiea953f282015-02-27 21:19:58 +0000334// CHECK: [[IV:%.+]] = load i32, i32* [[IT_OMP_IV]]{{.+}} !llvm.mem.parallel_loop_access ![[ITER_LOOP_ID:[0-9]+]]
335// CHECK-NEXT: [[LAST_IT:%.+]] = load i32, i32* [[OMP_LAST_IT]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000336// CHECK-NEXT: [[NUM_IT:%.+]] = add nsw i32 [[LAST_IT]], 1
337// CHECK-NEXT: [[CMP:%.+]] = icmp slt i32 [[IV]], [[NUM_IT]]
338// CHECK-NEXT: br i1 [[CMP]], label %[[IT_BODY:[^,]+]], label %[[IT_END:[^,]+]]
339 for (IterDouble i = ia; i < ib; ++i) {
340// CHECK: [[IT_BODY]]
341// Start of body: calculate i from index:
David Blaikiea953f282015-02-27 21:19:58 +0000342// CHECK: [[IV1:%.+]] = load i32, i32* [[IT_OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000343// Call of operator+ (i, IV).
Alexey Bataev36bf0112015-03-10 05:15:26 +0000344// CHECK: {{%.+}} = invoke {{.+}} @{{.*}}IterDouble{{.*}}
Alexander Musmana5f070a2014-10-01 06:03:56 +0000345// ... loop body ...
346 *i = *ic * 0.5;
347// Float multiply and save result.
348// CHECK: [[MULR:%.+]] = fmul double {{%.+}}, 5.000000e-01
Alexey Bataev36bf0112015-03-10 05:15:26 +0000349// CHECK-NEXT: invoke {{.+}} @{{.*}}IterDouble{{.*}}
Alexander Musmana5f070a2014-10-01 06:03:56 +0000350// CHECK: store double [[MULR:%.+]], double* [[RESULT_ADDR:%.+]], !llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]]
351 ++ic;
352//
David Blaikiea953f282015-02-27 21:19:58 +0000353// CHECK: [[IV2:%.+]] = load i32, i32* [[IT_OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000354// CHECK-NEXT: [[ADD2:%.+]] = add nsw i32 [[IV2]], 1
355// CHECK-NEXT: store i32 [[ADD2]], i32* [[IT_OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[ITER_LOOP_ID]]
356// br label %{{.*}}, !llvm.loop ![[ITER_LOOP_ID]]
357 }
358// CHECK: [[IT_END]]
359// CHECK: ret void
360}
361
362
363// CHECK-LABEL: define {{.*void}} @{{.*}}collapsed{{.*}}
364void collapsed(float *a, float *b, float *c, float *d) {
365 int i; // outer loop counter
366 unsigned j; // middle loop couter, leads to unsigned icmp in loop header.
367 // k declared in the loop init below
368 short l; // inner loop counter
369// CHECK: store i32 0, i32* [[OMP_IV:[^,]+]]
370//
371 #pragma omp simd collapse(4)
372
David Blaikiea953f282015-02-27 21:19:58 +0000373// CHECK: [[IV:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID:[0-9]+]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000374// CHECK-NEXT: [[CMP:%.+]] = icmp ult i32 [[IV]], 120
375// CHECK-NEXT: br i1 [[CMP]], label %[[COLL1_BODY:[^,]+]], label %[[COLL1_END:[^,]+]]
376 for (i = 1; i < 3; i++) // 2 iterations
377 for (j = 2u; j < 5u; j++) //3 iterations
378 for (int k = 3; k <= 6; k++) // 4 iterations
379 for (l = 4; l < 9; ++l) // 5 iterations
380 {
381// CHECK: [[COLL1_BODY]]
382// Start of body: calculate i from index:
David Blaikiea953f282015-02-27 21:19:58 +0000383// CHECK: [[IV1:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000384// Calculation of the loop counters values.
385// CHECK: [[CALC_I_1:%.+]] = udiv i32 [[IV1]], 60
386// CHECK-NEXT: [[CALC_I_1_MUL1:%.+]] = mul i32 [[CALC_I_1]], 1
387// CHECK-NEXT: [[CALC_I_2:%.+]] = add i32 1, [[CALC_I_1_MUL1]]
388// CHECK-NEXT: store i32 [[CALC_I_2]], i32* [[LC_I:.+]]
David Blaikiea953f282015-02-27 21:19:58 +0000389// CHECK: [[IV1_2:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000390// CHECK-NEXT: [[CALC_J_1:%.+]] = udiv i32 [[IV1_2]], 20
391// CHECK-NEXT: [[CALC_J_2:%.+]] = urem i32 [[CALC_J_1]], 3
392// CHECK-NEXT: [[CALC_J_2_MUL1:%.+]] = mul i32 [[CALC_J_2]], 1
393// CHECK-NEXT: [[CALC_J_3:%.+]] = add i32 2, [[CALC_J_2_MUL1]]
394// CHECK-NEXT: store i32 [[CALC_J_3]], i32* [[LC_J:.+]]
David Blaikiea953f282015-02-27 21:19:58 +0000395// CHECK: [[IV1_3:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000396// CHECK-NEXT: [[CALC_K_1:%.+]] = udiv i32 [[IV1_3]], 5
397// CHECK-NEXT: [[CALC_K_2:%.+]] = urem i32 [[CALC_K_1]], 4
398// CHECK-NEXT: [[CALC_K_2_MUL1:%.+]] = mul i32 [[CALC_K_2]], 1
399// CHECK-NEXT: [[CALC_K_3:%.+]] = add i32 3, [[CALC_K_2_MUL1]]
400// CHECK-NEXT: store i32 [[CALC_K_3]], i32* [[LC_K:.+]]
David Blaikiea953f282015-02-27 21:19:58 +0000401// CHECK: [[IV1_4:%.+]] = load i32, i32* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000402// CHECK-NEXT: [[CALC_L_1:%.+]] = urem i32 [[IV1_4]], 5
403// CHECK-NEXT: [[CALC_L_1_MUL1:%.+]] = mul i32 [[CALC_L_1]], 1
404// CHECK-NEXT: [[CALC_L_2:%.+]] = add i32 4, [[CALC_L_1_MUL1]]
405// CHECK-NEXT: [[CALC_L_3:%.+]] = trunc i32 [[CALC_L_2]] to i16
406// CHECK-NEXT: store i16 [[CALC_L_3]], i16* [[LC_L:.+]]
407// ... loop body ...
408// End of body: store into a[i]:
409// CHECK: store float [[RESULT:%.+]], float* [[RESULT_ADDR:%.+]]{{.+}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
410 float res = b[j] * c[k];
411 a[i] = res * d[l];
David Blaikiea953f282015-02-27 21:19:58 +0000412// CHECK: [[IV2:%.+]] = load i32, i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000413// CHECK-NEXT: [[ADD2:%.+]] = add i32 [[IV2]], 1
414// CHECK-NEXT: store i32 [[ADD2]], i32* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[COLL1_LOOP_ID]]
415// br label %{{[^,]+}}, !llvm.loop ![[COLL1_LOOP_ID]]
416// CHECK: [[COLL1_END]]
417 }
418// i,j,l are updated; k is not updated.
419// CHECK: store i32 3, i32* [[I:%[^,]+]]
420// CHECK-NEXT: store i32 5, i32* [[I:%[^,]+]]
421// CHECK-NEXT: store i16 9, i16* [[I:%[^,]+]]
422// CHECK: ret void
423}
424
425extern char foo();
Alexander Musman7931b982015-03-16 07:14:41 +0000426extern double globalfloat;
Alexander Musmana5f070a2014-10-01 06:03:56 +0000427
428// CHECK-LABEL: define {{.*void}} @{{.*}}widened{{.*}}
429void widened(float *a, float *b, float *c, float *d) {
430 int i; // outer loop counter
431 short j; // inner loop counter
Alexander Musman7931b982015-03-16 07:14:41 +0000432 globalfloat = 1.0;
433 int localint = 1;
434// CHECK: store double {{.+}}, double* [[GLOBALFLOAT:@.+]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000435// Counter is widened to 64 bits.
436// CHECK: store i64 0, i64* [[OMP_IV:[^,]+]]
437//
Alexander Musman7931b982015-03-16 07:14:41 +0000438 #pragma omp simd collapse(2) private(globalfloat, localint)
Alexander Musmana5f070a2014-10-01 06:03:56 +0000439
David Blaikiea953f282015-02-27 21:19:58 +0000440// CHECK: [[IV:%.+]] = load i64, i64* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID:[0-9]+]]
441// CHECK-NEXT: [[LI:%.+]] = load i64, i64* [[OMP_LI:%[^,]+]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000442// CHECK-NEXT: [[NUMIT:%.+]] = add nsw i64 [[LI]], 1
443// CHECK-NEXT: [[CMP:%.+]] = icmp slt i64 [[IV]], [[NUMIT]]
444// CHECK-NEXT: br i1 [[CMP]], label %[[WIDE1_BODY:[^,]+]], label %[[WIDE1_END:[^,]+]]
445 for (i = 1; i < 3; i++) // 2 iterations
446 for (j = 0; j < foo(); j++) // foo() iterations
447 {
448// CHECK: [[WIDE1_BODY]]
449// Start of body: calculate i from index:
David Blaikiea953f282015-02-27 21:19:58 +0000450// CHECK: [[IV1:%.+]] = load i64, i64* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000451// Calculation of the loop counters values...
452// CHECK: store i32 {{[^,]+}}, i32* [[LC_I:.+]]
David Blaikiea953f282015-02-27 21:19:58 +0000453// CHECK: [[IV1_2:%.+]] = load i64, i64* [[OMP_IV]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000454// CHECK: store i16 {{[^,]+}}, i16* [[LC_J:.+]]
455// ... loop body ...
Alexander Musman7931b982015-03-16 07:14:41 +0000456//
457// Here we expect store into private double var, not global
458// CHECK-NOT: store double {{.+}}, double* [[GLOBALFLOAT]]
459 globalfloat = (float)j/i;
Alexander Musmana5f070a2014-10-01 06:03:56 +0000460 float res = b[j] * c[j];
Alexander Musman7931b982015-03-16 07:14:41 +0000461// Store into a[i]:
462// CHECK: store float [[RESULT:%.+]], float* [[RESULT_ADDR:%.+]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000463 a[i] = res * d[i];
Alexander Musman7931b982015-03-16 07:14:41 +0000464// Then there's a store into private var localint:
465// CHECK: store i32 {{.+}}, i32* [[LOCALINT:%[^,]+]]{{.+}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]]
466 localint = (int)j;
David Blaikiea953f282015-02-27 21:19:58 +0000467// CHECK: [[IV2:%.+]] = load i64, i64* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]]
Alexander Musmana5f070a2014-10-01 06:03:56 +0000468// CHECK-NEXT: [[ADD2:%.+]] = add nsw i64 [[IV2]], 1
469// CHECK-NEXT: store i64 [[ADD2]], i64* [[OMP_IV]]{{.*}}!llvm.mem.parallel_loop_access ![[WIDE1_LOOP_ID]]
Alexander Musman7931b982015-03-16 07:14:41 +0000470//
Alexander Musmana5f070a2014-10-01 06:03:56 +0000471// br label %{{[^,]+}}, !llvm.loop ![[WIDE1_LOOP_ID]]
472// CHECK: [[WIDE1_END]]
473 }
474// i,j are updated.
475// CHECK: store i32 3, i32* [[I:%[^,]+]]
476// CHECK: store i16
Alexander Musman7931b982015-03-16 07:14:41 +0000477//
478// Here we expect store into original localint, not its privatized version.
479// CHECK-NOT: store i32 {{.+}}, i32* [[LOCALINT]]
480 localint = (int)j;
Alexander Musmana5f070a2014-10-01 06:03:56 +0000481// CHECK: ret void
482}
483
Alexey Bataev36bf0112015-03-10 05:15:26 +0000484// TERM_DEBUG-LABEL: bar
485int bar() {return 0;};
486
487// TERM_DEBUG-LABEL: parallel_simd
Alexey Bataev8cbe0a62015-02-26 10:27:34 +0000488void parallel_simd(float *a) {
489#pragma omp parallel
490#pragma omp simd
Alexey Bataev36bf0112015-03-10 05:15:26 +0000491 // TERM_DEBUG-NOT: __kmpc_global_thread_num
492 // TERM_DEBUG: invoke i32 {{.*}}bar{{.*}}()
493 // TERM_DEBUG: unwind label %[[TERM_LPAD:.+]],
494 // TERM_DEBUG-NOT: __kmpc_global_thread_num
Alexey Bataevda19af42015-03-10 05:28:46 +0000495 // TERM_DEBUG: [[TERM_LPAD]]
Alexey Bataev36bf0112015-03-10 05:15:26 +0000496 // TERM_DEBUG: call void @__clang_call_terminate
497 // TERM_DEBUG: unreachable
Alexey Bataev8cbe0a62015-02-26 10:27:34 +0000498 for (unsigned i = 131071; i <= 2147483647; i += 127)
Alexey Bataev36bf0112015-03-10 05:15:26 +0000499 a[i] += bar();
Alexey Bataev8cbe0a62015-02-26 10:27:34 +0000500}
Duncan P. N. Exon Smith9dd4e4e2015-04-29 16:40:08 +0000501// TERM_DEBUG: !{{[0-9]+}} = !DILocation(line: [[@LINE-11]],
Alexander Musmana5f070a2014-10-01 06:03:56 +0000502#endif // HEADER
503