diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2015-09-04 11:26:21 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2015-09-04 11:26:21 +0000 |
commit | caacd53dde6ea46d03abf272aa996957433ce31d (patch) | |
tree | c3edcda81f236070fc44b8cd5f00528a8b9e8f88 /clang/test/OpenMP/for_firstprivate_codegen.cpp | |
parent | cb405bf311d38c720601ad9cdac787d83f1a9e6f (diff) | |
download | bcm5719-llvm-caacd53dde6ea46d03abf272aa996957433ce31d.tar.gz bcm5719-llvm-caacd53dde6ea46d03abf272aa996957433ce31d.zip |
[OPENMP] Fix for http://llvm.org/PR24674: assertion failed and and abort trap
Fix processing of shared variables with reference types in OpenMP constructs. Previously, if the variable was not marked in one of the private clauses, the reference to this variable was emitted incorrectly and caused an assertion later.
llvm-svn: 246846
Diffstat (limited to 'clang/test/OpenMP/for_firstprivate_codegen.cpp')
-rw-r--r-- | clang/test/OpenMP/for_firstprivate_codegen.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/test/OpenMP/for_firstprivate_codegen.cpp b/clang/test/OpenMP/for_firstprivate_codegen.cpp index 91061dcc2b7..a8a44374d83 100644 --- a/clang/test/OpenMP/for_firstprivate_codegen.cpp +++ b/clang/test/OpenMP/for_firstprivate_codegen.cpp @@ -16,6 +16,7 @@ struct St { }; volatile int g = 1212; +volatile int &g1 = g; template <class T> struct S { @@ -71,7 +72,7 @@ int main() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( // LAMBDA: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* %{{.+}}) #pragma omp parallel -#pragma omp for firstprivate(g) +#pragma omp for firstprivate(g, g1) for (int i = 0; i < 2; ++i) { // LAMBDA: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* %{{.+}}, i32* %{{.+}}, %{{.+}}* [[ARG:%.+]]) // Skip temp vars for loop @@ -85,6 +86,7 @@ int main() { // LAMBDA: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // LAMBDA: call void @__kmpc_barrier( g = 1; + g1 = 1; // LAMBDA: call void @__kmpc_for_static_init_4( // LAMBDA: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 @@ -96,6 +98,7 @@ int main() { // LAMBDA: define {{.+}} void [[INNER_LAMBDA]](%{{.+}}* [[ARG_PTR:%.+]]) // LAMBDA: store %{{.+}}* [[ARG_PTR]], %{{.+}}** [[ARG_PTR_REF:%.+]], g = 2; + g1 = 2; // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]] // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_PTR_REF]] @@ -112,7 +115,7 @@ int main() { // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* // BLOCKS: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* %{{.+}}) #pragma omp parallel -#pragma omp for firstprivate(g) +#pragma omp for firstprivate(g, g1) for (int i = 0; i < 2; ++i) { // BLOCKS: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* %{{.+}}, i32* %{{.+}}, %{{.+}}* [[ARG:%.+]]) // Skip temp vars for loop @@ -126,6 +129,7 @@ int main() { // BLOCKS: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // BLOCKS: call void @__kmpc_barrier( g = 1; + g1 =1; // BLOCKS: call void @__kmpc_for_static_init_4( // BLOCKS: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} @@ -137,6 +141,7 @@ int main() { ^{ // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; + g1 = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: store i{{[0-9]+}} 2, i{{[0-9]+}}* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} |