diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2019-07-18 19:40:24 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-07-18 19:40:24 +0000 |
commit | 0c99d19470bab02158856ac88dc1cc0fb40a4570 (patch) | |
tree | 8a0549773668260d42a8520de108e6eed7e1c337 /clang/test/OpenMP/parallel_copyin_codegen.cpp | |
parent | 892758a52651f335ae4cd5f79bcb4f2c2e119e81 (diff) | |
download | bcm5719-llvm-0c99d19470bab02158856ac88dc1cc0fb40a4570.tar.gz bcm5719-llvm-0c99d19470bab02158856ac88dc1cc0fb40a4570.zip |
[OPENMP]Fix sharing of threadprivate variables with TLS support.
If the threadprivate variable is used in the copyin clause on inner
parallel directive with TLS support, we capture this variable in all
outer OpenMP scopes. It leads to the fact that in all scopes we're
working with the original variable, not the threadprivate copies.
llvm-svn: 366483
Diffstat (limited to 'clang/test/OpenMP/parallel_copyin_codegen.cpp')
-rw-r--r-- | clang/test/OpenMP/parallel_copyin_codegen.cpp | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/clang/test/OpenMP/parallel_copyin_codegen.cpp b/clang/test/OpenMP/parallel_copyin_codegen.cpp index 8fa9edd2c1a..87c11f04061 100644 --- a/clang/test/OpenMP/parallel_copyin_codegen.cpp +++ b/clang/test/OpenMP/parallel_copyin_codegen.cpp @@ -19,6 +19,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple x86_64-linux -emit-llvm %s -o - | FileCheck -check-prefix=TLS-LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-linux -emit-llvm %s -o - | FileCheck -check-prefix=TLS-BLOCKS %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DARRAY -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck -check-prefix=TLS-ARRAY %s +// RUN: %clang_cc1 -verify -fopenmp -x c++ -DNESTED -triple x86_64-linux -emit-llvm %s -o - | FileCheck %s -check-prefix=NESTED // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple x86_64-linux -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY1 %s // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-linux -emit-pch -o %t %s @@ -28,7 +29,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -std=c++11 -DARRAY -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY1 %s // SIMD-ONLY1-NOT: {{__kmpc|__tgt}} // expected-no-diagnostics -#ifndef ARRAY +#if !defined(ARRAY) && !defined(NESTED) #ifndef HEADER #define HEADER @@ -493,7 +494,7 @@ int main() { // TLS-CHECK: ret void #endif -#else +#elif defined(ARRAY) // ARRAY-LABEL: array_func // TLS-ARRAY-LABEL: array_func @@ -522,6 +523,24 @@ void array_func() { #pragma omp parallel copyin(a, s) ; } -#endif - +#elif defined(NESTED) +int t; +#pragma omp threadprivate(t) +// NESTED: foo +void foo() { + // NESTED: call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* @{{.+}}, i32 0, void (i32*, i32*, ...)* bitcast (void (i32*, i32*)* [[OUTLINED:@.+]] to void (i32*, i32*, ...)*)) +#pragma omp parallel +#pragma omp parallel copyin(t) + ++t; +} +// NESTED: define {{.*}}void [[OUTLINED]]( +// NESTED: [[T:%.+]] = call i32* [[THRP_T:@.+]]() +// NESTED: call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%struct.ident_t* @{{.+}}, i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, i32*)* [[OUTLINED1:@.+]] to void (i32*, i32*, ...)*), i32* [[T]]) + +// NESTED: define {{.*}}void [[OUTLINED1]]( +// NESTED: [[T_MASTER:%.+]] = load i32*, i32** % +// NESTED: [[T:%.+]] = call i32* [[THRP_T]]() +// NESTED: [[T_MASTER_VAL:%.+]] = load i32, i32* [[T_MASTER]], +// NESTED: store i32 [[T_MASTER_VAL]], i32* [[T]], +#endif // NESTED |