|
| 1 | +// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --functions "main" --replace-value-regex "[0-9][0-9][0-9]+" --prefix-filecheck-ir-name _ |
| 2 | + |
| 3 | +// FIXME: The hash used to identify taskgraph regions (the fourth argument of |
| 4 | +// __kmpc_taskgraph) is unstable between the two compiler invocations below, |
| 5 | +// and furthermore is a little hard to identify with update_cc_test_checks.py. |
| 6 | +// The above works for now, but it's not ideal. |
| 7 | + |
| 8 | +// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s |
| 9 | +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s |
| 10 | +// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s |
| 11 | +// expected-no-diagnostics |
| 12 | + |
| 13 | +#ifndef HEADER |
| 14 | +#define HEADER |
| 15 | + |
| 16 | +// CHECK-LABEL: @main( |
| 17 | +// CHECK-NEXT: entry: |
| 18 | +// CHECK-NEXT: [[RETVAL:%.*]] = alloca i32, align 4 |
| 19 | +// CHECK-NEXT: [[X:%.*]] = alloca i32, align 4 |
| 20 | +// CHECK-NEXT: [[Y:%.*]] = alloca i32, align 4 |
| 21 | +// CHECK-NEXT: [[AGG_CAPTURED:%.*]] = alloca [[STRUCT_ANON:%.*]], align 8 |
| 22 | +// CHECK-NEXT: [[TMP0:%.*]] = call i32 @__kmpc_global_thread_num(ptr @[[GLOB1:[0-9]+]]) |
| 23 | +// CHECK-NEXT: store i32 0, ptr [[RETVAL]], align 4 |
| 24 | +// CHECK-NEXT: store i32 0, ptr [[X]], align 4 |
| 25 | +// CHECK-NEXT: store i32 0, ptr [[Y]], align 4 |
| 26 | +// CHECK-NEXT: [[TMP1:%.*]] = getelementptr inbounds nuw [[STRUCT_ANON]], ptr [[AGG_CAPTURED]], i32 0, i32 0 |
| 27 | +// CHECK-NEXT: store ptr [[X]], ptr [[TMP1]], align 8 |
| 28 | +// CHECK-NEXT: [[TMP2:%.*]] = getelementptr inbounds nuw [[STRUCT_ANON]], ptr [[AGG_CAPTURED]], i32 0, i32 1 |
| 29 | +// CHECK-NEXT: store ptr [[Y]], ptr [[TMP2]], align 8 |
| 30 | +// CHECK-NEXT: call void @__kmpc_taskgraph(ptr @[[GLOB1]], i32 [[TMP0]], i32 0, i32 {{[0-9][0-9][0-9]+}}, ptr @taskgraph.omp_outlined., ptr [[AGG_CAPTURED]]) |
| 31 | +// CHECK-NEXT: ret i32 0 |
| 32 | +// |
| 33 | +int main() { |
| 34 | + int x = 0, y = 0; |
| 35 | + |
| 36 | +#pragma omp taskgraph |
| 37 | + { |
| 38 | +#pragma omp task depend(in: x) depend(out: y) |
| 39 | + { |
| 40 | + y = x; |
| 41 | + } |
| 42 | +#pragma omp task depend(inout: x, y) |
| 43 | + { |
| 44 | + x++; |
| 45 | + y++; |
| 46 | + } |
| 47 | + } |
| 48 | + |
| 49 | + return 0; |
| 50 | +} |
| 51 | + |
| 52 | +#endif |
0 commit comments