Alexey Bataev | db39021 | 2015-05-20 04:24:19 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -x c++ -emit-llvm %s -o - | FileCheck %s |
| 2 | // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -emit-pch -o %t %s |
| 3 | // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 4 | // expected-no-diagnostics |
Adrian Prantl | bc06858 | 2015-07-08 01:00:30 +0000 | [diff] [blame] | 5 | // REQUIRES: x86-registered-target |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 6 | #ifndef HEADER |
| 7 | #define HEADER |
| 8 | |
| 9 | // CHECK-DAG: [[IDENT_T:%.+]] = type { i32, i32, i32, i32, i8* } |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 10 | // CHECK-DAG: [[STRUCT_SHAREDS:%.+]] = type { i8*, [2 x [[STRUCT_S:%.+]]]* } |
| 11 | // CHECK-DAG: [[STRUCT_SHAREDS1:%.+]] = type { [2 x [[STRUCT_S:%.+]]]* } |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 12 | // CHECK-DAG: [[KMP_TASK_T:%.+]] = type { i8*, i32 (i32, i8*)*, i32, i32 (i32, i8*)* } |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 13 | // CHECK-DAG: [[KMP_DEPEND_INFO:%.+]] = type { i64, i64, i8 } |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 14 | struct S { |
| 15 | int a; |
| 16 | S() : a(0) {} |
| 17 | S(const S &s) : a(s.a) {} |
| 18 | ~S() {} |
| 19 | }; |
| 20 | int a; |
Hans Wennborg | 2151d12 | 2015-08-31 21:48:52 +0000 | [diff] [blame] | 21 | // CHECK-LABEL: @main |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 22 | int main() { |
| 23 | // CHECK: [[B:%.+]] = alloca i8 |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 24 | // CHECK: [[S:%.+]] = alloca [2 x [[STRUCT_S]]] |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 25 | char b; |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 26 | S s[2]; |
Alexey Bataev | d6fdc8b | 2015-08-31 07:32:19 +0000 | [diff] [blame] | 27 | int arr[10][a]; |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 28 | // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T]]* @{{.+}}) |
| 29 | // CHECK: [[B_REF:%.+]] = getelementptr inbounds [[STRUCT_SHAREDS]], [[STRUCT_SHAREDS]]* [[CAPTURES:%.+]], i32 0, i32 0 |
| 30 | // CHECK: store i8* [[B]], i8** [[B_REF]] |
| 31 | // CHECK: [[S_REF:%.+]] = getelementptr inbounds [[STRUCT_SHAREDS]], [[STRUCT_SHAREDS]]* [[CAPTURES]], i32 0, i32 1 |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 32 | // CHECK: store [2 x [[STRUCT_S]]]* [[S]], [2 x [[STRUCT_S]]]** [[S_REF]] |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 33 | // CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 1, i64 32, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY1:@.+]] to i32 (i32, i8*)*)) |
| 34 | // CHECK: [[SHAREDS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_PTR:%.+]], i32 0, i32 0 |
| 35 | // CHECK: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS_REF_PTR]] |
| 36 | // CHECK: [[BITCAST:%.+]] = bitcast [[STRUCT_SHAREDS]]* [[CAPTURES]] to i8* |
| 37 | // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[SHAREDS_REF]], i8* [[BITCAST]], i64 16, i32 8, i1 false) |
| 38 | // CHECK: [[DESTRUCTORS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_PTR]], i32 0, i32 3 |
| 39 | // CHECK: store i32 (i32, i8*)* null, i32 (i32, i8*)** [[DESTRUCTORS_REF_PTR]] |
| 40 | // CHECK: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]]) |
| 41 | #pragma omp task shared(a, b, s) |
| 42 | { |
| 43 | a = 15; |
| 44 | b = a; |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 45 | s[0].a = 10; |
| 46 | } |
| 47 | // CHECK: [[S_REF:%.+]] = getelementptr inbounds [[STRUCT_SHAREDS1]], [[STRUCT_SHAREDS1]]* [[CAPTURES:%.+]], i32 0, i32 0 |
| 48 | // CHECK: store [2 x [[STRUCT_S]]]* [[S]], [2 x [[STRUCT_S]]]** [[S_REF]] |
| 49 | // CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{[^,]+}}, i32 [[GTID]], i32 1, i64 32, i64 8, |
| 50 | // CHECK: [[SHAREDS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_PTR:%.+]], i32 0, i32 0 |
| 51 | // CHECK: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS_REF_PTR]] |
| 52 | // CHECK: [[BITCAST:%.+]] = bitcast [[STRUCT_SHAREDS1]]* [[CAPTURES]] to i8* |
| 53 | // CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[SHAREDS_REF]], i8* [[BITCAST]], i64 8, i32 8, i1 false) |
| 54 | // CHECK: [[DESTRUCTORS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_PTR]], i32 0, i32 3 |
| 55 | // CHECK: store i32 (i32, i8*)* null, i32 (i32, i8*)** [[DESTRUCTORS_REF_PTR]] |
John McCall | 7f416cc | 2015-09-08 08:05:57 +0000 | [diff] [blame] | 56 | // CHECK: [[DEP:%.*]] = getelementptr inbounds [4 x [[KMP_DEPEND_INFO]]], [4 x [[KMP_DEPEND_INFO]]]* [[DEPENDENCIES:%.*]], i64 0, i64 0 |
| 57 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* [[DEP]], i32 0, i32 0 |
| 58 | // CHECK: store i64 ptrtoint (i32* @{{.+}} to i64), i64* [[T0]] |
| 59 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* [[DEP]], i32 0, i32 1 |
| 60 | // CHECK: store i64 4, i64* [[T0]] |
| 61 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* [[DEP]], i32 0, i32 2 |
| 62 | // CHECK: store i8 1, i8* [[T0]] |
| 63 | // CHECK: [[DEP:%.*]] = getelementptr inbounds [4 x [[KMP_DEPEND_INFO]]], [4 x [[KMP_DEPEND_INFO]]]* [[DEPENDENCIES]], i64 0, i64 1 |
| 64 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* [[DEP]], i32 0, i32 0 |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 65 | // CHECK: ptrtoint i8* [[B]] to i64 |
John McCall | 7f416cc | 2015-09-08 08:05:57 +0000 | [diff] [blame] | 66 | // CHECK: store i64 %{{[^,]+}}, i64* [[T0]] |
| 67 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* [[DEP]], i32 0, i32 1 |
| 68 | // CHECK: store i64 1, i64* [[T0]] |
| 69 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* [[DEP]], i32 0, i32 2 |
| 70 | // CHECK: store i8 1, i8* [[T0]] |
| 71 | // CHECK: [[DEP:%.*]] = getelementptr inbounds [4 x [[KMP_DEPEND_INFO]]], [4 x [[KMP_DEPEND_INFO]]]* [[DEPENDENCIES]], i64 0, i64 2 |
| 72 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* [[DEP]], i32 0, i32 0 |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 73 | // CHECK: ptrtoint [2 x [[STRUCT_S]]]* [[S]] to i64 |
John McCall | 7f416cc | 2015-09-08 08:05:57 +0000 | [diff] [blame] | 74 | // CHECK: store i64 %{{[^,]+}}, i64* [[T0]] |
| 75 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* [[DEP]], i32 0, i32 1 |
| 76 | // CHECK: store i64 8, i64* [[T0]] |
| 77 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* [[DEP]], i32 0, i32 2 |
| 78 | // CHECK: store i8 1, i8* [[T0]] |
Alexey Bataev | d6fdc8b | 2015-08-31 07:32:19 +0000 | [diff] [blame] | 79 | // CHECK: [[IDX1:%.+]] = mul nsw i64 0, [[A_VAL:%.+]] |
| 80 | // CHECK: [[START:%.+]] = getelementptr inbounds i32, i32* %{{.+}}, i64 [[IDX1]] |
| 81 | // CHECK: [[IDX1:%.+]] = mul nsw i64 9, [[A_VAL]] |
| 82 | // CHECK: [[END:%.+]] = getelementptr inbounds i32, i32* %{{.+}}, i64 [[IDX1]] |
| 83 | // CHECK: [[END1:%.+]] = getelementptr i32, i32* [[END]], i32 1 |
| 84 | // CHECK: [[START_INT:%.+]] = ptrtoint i32* [[START]] to i64 |
| 85 | // CHECK: [[END_INT:%.+]] = ptrtoint i32* [[END1]] to i64 |
| 86 | // CHECK: [[SIZEOF:%.+]] = sub nuw i64 [[END_INT]], [[START_INT]] |
John McCall | 7f416cc | 2015-09-08 08:05:57 +0000 | [diff] [blame] | 87 | // CHECK: [[DEP:%.*]] = getelementptr inbounds [4 x [[KMP_DEPEND_INFO]]], [4 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i64 0, i64 3 |
| 88 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* [[DEP]], i32 0, i32 0 |
| 89 | // CHECK: [[T1:%.*]] = ptrtoint i32* [[START]] to i64 |
| 90 | // CHECK: store i64 [[T1]], i64* [[T0]] |
| 91 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 1 |
| 92 | // CHECK: store i64 [[SIZEOF]], i64* [[T0]] |
| 93 | // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 |
| 94 | // CHECK: store i8 1, i8* [[T0]] |
| 95 | // CHECK: [[DEPS:%.*]] = getelementptr inbounds [4 x [[KMP_DEPEND_INFO]]], [4 x [[KMP_DEPEND_INFO]]]* [[DEPENDENCIES]], i32 0, i32 0 |
| 96 | // CHECK: bitcast [[KMP_DEPEND_INFO]]* [[DEPS]] to i8* |
Alexey Bataev | d6fdc8b | 2015-08-31 07:32:19 +0000 | [diff] [blame] | 97 | // CHECK: call i32 @__kmpc_omp_task_with_deps([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]], i32 4, i8* %{{[^,]+}}, i32 0, i8* null) |
| 98 | #pragma omp task shared(a, s) depend(in : a, b, s, arr[:]) |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 99 | { |
| 100 | a = 15; |
| 101 | s[1].a = 10; |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 102 | } |
| 103 | // CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 0, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*)) |
| 104 | // CHECK: [[DESTRUCTORS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]]{{.*}}* {{%.+}}, i32 0, i32 3 |
| 105 | // CHECK: store i32 (i32, i8*)* null, i32 (i32, i8*)** [[DESTRUCTORS_REF_PTR]] |
| 106 | // CHECK: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]]) |
| 107 | #pragma omp task untied |
| 108 | { |
| 109 | a = 1; |
| 110 | } |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 111 | // CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 0, i64 32, i64 1, |
| 112 | // CHECK: [[DESTRUCTORS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]]{{.*}}* {{%.+}}, i32 0, i32 3 |
| 113 | // CHECK: store i32 (i32, i8*)* null, i32 (i32, i8*)** [[DESTRUCTORS_REF_PTR]] |
John McCall | 7f416cc | 2015-09-08 08:05:57 +0000 | [diff] [blame] | 114 | // CHECK: getelementptr inbounds [2 x [[STRUCT_S]]], [2 x [[STRUCT_S]]]* [[S]], i64 0, i64 0 |
| 115 | // CHECK: getelementptr inbounds [2 x [[KMP_DEPEND_INFO]]], [2 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i64 0, i64 0 |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 116 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0 |
| 117 | // CHECK: ptrtoint [[STRUCT_S]]* %{{.+}} to i64 |
| 118 | // CHECK: store i64 %{{[^,]+}}, i64* |
| 119 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 1 |
| 120 | // CHECK: store i64 4, i64* |
| 121 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 |
| 122 | // CHECK: store i8 2, i8* |
Alexey Bataev | d6fdc8b | 2015-08-31 07:32:19 +0000 | [diff] [blame] | 123 | // CHECK: [[IDX1:%.+]] = mul nsw i64 4, [[A_VAL]] |
| 124 | // CHECK: [[START:%.+]] = getelementptr inbounds i32, i32* %{{.+}}, i64 [[IDX1]] |
| 125 | // CHECK: [[B_VAL:%.+]] = load i8, i8* [[B]] |
| 126 | // CHECK: [[IDX2:%.+]] = sext i8 [[B_VAL]] to i64 |
| 127 | // CHECK: [[START1:%.+]] = getelementptr inbounds i32, i32* [[START]], i64 [[IDX2]] |
| 128 | // CHECK: [[IDX1:%.+]] = mul nsw i64 9, [[A_VAL]] |
| 129 | // CHECK: [[END:%.+]] = getelementptr inbounds i32, i32* %{{.+}}, i64 [[IDX1]] |
| 130 | // CHECK: [[B_VAL:%.+]] = load i8, i8* [[B]] |
| 131 | // CHECK: [[IDX2:%.+]] = sext i8 [[B_VAL]] to i64 |
| 132 | // CHECK: [[END1:%.+]] = getelementptr inbounds i32, i32* [[END]], i64 [[IDX2]] |
| 133 | // CHECK: [[END2:%.+]] = getelementptr i32, i32* [[END1]], i32 1 |
| 134 | // CHECK: [[START_INT:%.+]] = ptrtoint i32* [[START1]] to i64 |
| 135 | // CHECK: [[END_INT:%.+]] = ptrtoint i32* [[END2]] to i64 |
| 136 | // CHECK: [[SIZEOF:%.+]] = sub nuw i64 [[END_INT]], [[START_INT]] |
John McCall | 7f416cc | 2015-09-08 08:05:57 +0000 | [diff] [blame] | 137 | // CHECK: getelementptr inbounds [2 x [[KMP_DEPEND_INFO]]], [2 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i64 0, i64 1 |
Alexey Bataev | d6fdc8b | 2015-08-31 07:32:19 +0000 | [diff] [blame] | 138 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0 |
| 139 | // CHECK: ptrtoint i32* [[START1]] to i64 |
| 140 | // CHECK: store i64 %{{[^,]+}}, i64* |
| 141 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 1 |
| 142 | // CHECK: store i64 [[SIZEOF]], i64* |
| 143 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 |
| 144 | // CHECK: store i8 2, i8* |
| 145 | // CHECK: getelementptr inbounds [2 x [[KMP_DEPEND_INFO]]], [2 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i32 0, i32 0 |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 146 | // CHECK: bitcast [[KMP_DEPEND_INFO]]* %{{.+}} to i8* |
Alexey Bataev | d6fdc8b | 2015-08-31 07:32:19 +0000 | [diff] [blame] | 147 | // CHECK: call i32 @__kmpc_omp_task_with_deps([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]], i32 2, i8* %{{[^,]+}}, i32 0, i8* null) |
| 148 | #pragma omp task untied depend(out : s[0], arr[4:][b]) |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 149 | { |
| 150 | a = 1; |
| 151 | } |
| 152 | // CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 3, i64 32, i64 1, |
| 153 | // CHECK: [[DESTRUCTORS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]]{{.*}}* {{%.+}}, i32 0, i32 3 |
| 154 | // CHECK: store i32 (i32, i8*)* null, i32 (i32, i8*)** [[DESTRUCTORS_REF_PTR]] |
John McCall | 7f416cc | 2015-09-08 08:05:57 +0000 | [diff] [blame] | 155 | // CHECK: getelementptr inbounds [3 x [[KMP_DEPEND_INFO]]], [3 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i64 0, i64 0 |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 156 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0 |
| 157 | // CHECK: store i64 ptrtoint (i32* @{{.+}} to i64), i64* |
| 158 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 1 |
| 159 | // CHECK: store i64 4, i64* |
| 160 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 |
| 161 | // CHECK: store i8 3, i8* |
John McCall | 7f416cc | 2015-09-08 08:05:57 +0000 | [diff] [blame] | 162 | // CHECK: getelementptr inbounds [2 x [[STRUCT_S]]], [2 x [[STRUCT_S]]]* [[S]], i64 0, i64 1 |
| 163 | // CHECK: getelementptr inbounds [3 x [[KMP_DEPEND_INFO]]], [3 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i64 0, i64 1 |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 164 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0 |
| 165 | // CHECK: ptrtoint [[STRUCT_S]]* %{{.+}} to i64 |
| 166 | // CHECK: store i64 %{{[^,]+}}, i64* |
| 167 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 1 |
| 168 | // CHECK: store i64 4, i64* |
| 169 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 |
| 170 | // CHECK: store i8 3, i8* |
Alexey Bataev | d6fdc8b | 2015-08-31 07:32:19 +0000 | [diff] [blame] | 171 | // CHECK: [[IDX1:%.+]] = mul nsw i64 0, [[A_VAL]] |
| 172 | // CHECK: [[START:%.+]] = getelementptr inbounds i32, i32* %{{.+}}, i64 [[IDX1]] |
| 173 | // CHECK: [[START1:%.+]] = getelementptr inbounds i32, i32* [[START]], i64 3 |
| 174 | // CHECK: [[NEW_A_VAL:%.+]] = load i32, i32* @{{.+}}, |
| 175 | // CHECK: [[NEW_A_VAL_I64:%.+]] = sext i32 [[NEW_A_VAL]] to i64 |
| 176 | // CHECK: [[SUB:%.+]] = add nsw i64 -1, [[NEW_A_VAL_I64]] |
| 177 | // CHECK: [[IDX1:%.+]] = mul nsw i64 [[SUB]], [[A_VAL]] |
| 178 | // CHECK: [[END:%.+]] = getelementptr inbounds i32, i32* %{{.+}}, i64 [[IDX1]] |
| 179 | // CHECK: [[NEW_A_VAL:%.+]] = load i32, i32* @{{.+}}, |
| 180 | // CHECK: [[NEW_A_VAL_I64:%.+]] = sext i32 [[NEW_A_VAL]] to i64 |
| 181 | // CHECK: [[IDX2:%.+]] = sub nsw i64 [[NEW_A_VAL_I64]], 1 |
| 182 | // CHECK: [[END1:%.+]] = getelementptr inbounds i32, i32* [[END]], i64 [[IDX2]] |
| 183 | // CHECK: [[END2:%.+]] = getelementptr i32, i32* [[END1]], i32 1 |
| 184 | // CHECK: [[START_INT:%.+]] = ptrtoint i32* [[START1]] to i64 |
| 185 | // CHECK: [[END_INT:%.+]] = ptrtoint i32* [[END2]] to i64 |
| 186 | // CHECK: [[SIZEOF:%.+]] = sub nuw i64 [[END_INT]], [[START_INT]] |
John McCall | 7f416cc | 2015-09-08 08:05:57 +0000 | [diff] [blame] | 187 | // CHECK: getelementptr inbounds [3 x [[KMP_DEPEND_INFO]]], [3 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i64 0, i64 2 |
Alexey Bataev | d6fdc8b | 2015-08-31 07:32:19 +0000 | [diff] [blame] | 188 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0 |
| 189 | // CHECK: ptrtoint i32* [[START1]] to i64 |
| 190 | // CHECK: store i64 %{{[^,]+}}, i64* |
| 191 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 1 |
| 192 | // CHECK: store i64 [[SIZEOF]], i64* |
| 193 | // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 |
| 194 | // CHECK: store i8 3, i8* |
| 195 | // CHECK: getelementptr inbounds [3 x [[KMP_DEPEND_INFO]]], [3 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i32 0, i32 0 |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 196 | // CHECK: bitcast [[KMP_DEPEND_INFO]]* %{{.+}} to i8* |
Alexey Bataev | d6fdc8b | 2015-08-31 07:32:19 +0000 | [diff] [blame] | 197 | // CHECK: call i32 @__kmpc_omp_task_with_deps([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]], i32 3, i8* %{{[^,]+}}, i32 0, i8* null) |
| 198 | #pragma omp task final(true) depend(inout: a, s[1], arr[:a][3:]) |
Alexey Bataev | 1d2353d | 2015-06-24 11:01:36 +0000 | [diff] [blame] | 199 | { |
| 200 | a = 2; |
| 201 | } |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 202 | // CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 3, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY3:@.+]] to i32 (i32, i8*)*)) |
| 203 | // CHECK: [[DESTRUCTORS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]]{{.*}}* {{%.+}}, i32 0, i32 3 |
| 204 | // CHECK: store i32 (i32, i8*)* null, i32 (i32, i8*)** [[DESTRUCTORS_REF_PTR]] |
| 205 | // CHECK: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]]) |
| 206 | #pragma omp task final(true) |
| 207 | { |
| 208 | a = 2; |
| 209 | } |
| 210 | // CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 1, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY4:@.+]] to i32 (i32, i8*)*)) |
| 211 | // CHECK: [[DESTRUCTORS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]]{{.*}}* {{%.*}}, i32 0, i32 3 |
| 212 | // CHECK: store i32 (i32, i8*)* null, i32 (i32, i8*)** [[DESTRUCTORS_REF_PTR]] |
| 213 | // CHECK: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]]) |
| 214 | const bool flag = false; |
| 215 | #pragma omp task final(flag) |
| 216 | { |
| 217 | a = 3; |
| 218 | } |
| 219 | // CHECK: [[B_VAL:%.+]] = load i8, i8* [[B]] |
| 220 | // CHECK: [[CMP:%.+]] = icmp ne i8 [[B_VAL]], 0 |
| 221 | // CHECK: [[FINAL:%.+]] = select i1 [[CMP]], i32 2, i32 0 |
| 222 | // CHECK: [[FLAGS:%.+]] = or i32 [[FINAL]], 1 |
| 223 | // CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 [[FLAGS]], i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY5:@.+]] to i32 (i32, i8*)*)) |
| 224 | // CHECK: [[DESTRUCTORS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]]{{.*}}* {{%.+}}, i32 0, i32 3 |
| 225 | // CHECK: store i32 (i32, i8*)* null, i32 (i32, i8*)** [[DESTRUCTORS_REF_PTR]] |
| 226 | // CHECK: call i32 @__kmpc_omp_task([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]]) |
| 227 | #pragma omp task final(b) |
| 228 | { |
| 229 | a = 4; |
| 230 | } |
| 231 | return a; |
| 232 | } |
Alexey Bataev | 2377fe9 | 2015-09-10 08:12:02 +0000 | [diff] [blame] | 233 | // CHECK: define internal i32 [[TASK_ENTRY1]](i32, [[KMP_TASK_T]]{{.*}}* noalias) |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 234 | // CHECK: store i32 15, i32* [[A_PTR:@.+]] |
| 235 | // CHECK: [[A_VAL:%.+]] = load i32, i32* [[A_PTR]] |
| 236 | // CHECK: [[A_VAL_I8:%.+]] = trunc i32 [[A_VAL]] to i8 |
| 237 | // CHECK: store i8 [[A_VAL_I8]], i8* %{{.+}} |
| 238 | // CHECK: store i32 10, i32* %{{.+}} |
| 239 | |
Alexey Bataev | 2377fe9 | 2015-09-10 08:12:02 +0000 | [diff] [blame] | 240 | // CHECK: define internal i32 [[TASK_ENTRY2]](i32, [[KMP_TASK_T]]{{.*}}* noalias) |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 241 | // CHECK: store i32 1, i32* [[A_PTR:@.+]] |
| 242 | |
Alexey Bataev | 2377fe9 | 2015-09-10 08:12:02 +0000 | [diff] [blame] | 243 | // CHECK: define internal i32 [[TASK_ENTRY3]](i32, [[KMP_TASK_T]]{{.*}}* noalias) |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 244 | // CHECK: store i32 2, i32* [[A_PTR:@.+]] |
| 245 | |
Alexey Bataev | 2377fe9 | 2015-09-10 08:12:02 +0000 | [diff] [blame] | 246 | // CHECK: define internal i32 [[TASK_ENTRY4]](i32, [[KMP_TASK_T]]{{.*}}* noalias) |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 247 | // CHECK: store i32 3, i32* [[A_PTR:@.+]] |
| 248 | |
Alexey Bataev | 2377fe9 | 2015-09-10 08:12:02 +0000 | [diff] [blame] | 249 | // CHECK: define internal i32 [[TASK_ENTRY5]](i32, [[KMP_TASK_T]]{{.*}}* noalias) |
Alexey Bataev | 62b63b1 | 2015-03-10 07:28:44 +0000 | [diff] [blame] | 250 | // CHECK: store i32 4, i32* [[A_PTR:@.+]] |
| 251 | #endif |
| 252 | |