diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2016-11-17 15:12:05 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-11-17 15:12:05 +0000 |
| commit | 957d856e7e02de9b172c943c76b6d5caeef31d9b (patch) | |
| tree | d11f04a6991eb06e20b78ab088d91e74e8b106a9 /clang/test/OpenMP/cancel_codegen.cpp | |
| parent | 5831a00634753782221ae01191a5db0783b0ea88 (diff) | |
| download | bcm5719-llvm-957d856e7e02de9b172c943c76b6d5caeef31d9b.tar.gz bcm5719-llvm-957d856e7e02de9b172c943c76b6d5caeef31d9b.zip | |
[OPENMP] Fixed codegen for 'omp cancel' construct.
If 'omp cancel' construct is used in a worksharing construct it may
cause hanging of the software in case if reduction clause is used. Patch fixes this problem by avoiding extra reduction processing for branches that were canceled.
llvm-svn: 287227
Diffstat (limited to 'clang/test/OpenMP/cancel_codegen.cpp')
| -rw-r--r-- | clang/test/OpenMP/cancel_codegen.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/test/OpenMP/cancel_codegen.cpp b/clang/test/OpenMP/cancel_codegen.cpp index fb0a4dd54a2..5a3b96bba9a 100644 --- a/clang/test/OpenMP/cancel_codegen.cpp +++ b/clang/test/OpenMP/cancel_codegen.cpp @@ -90,9 +90,11 @@ for (int i = 0; i < argc; ++i) { } } // CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( -#pragma omp parallel for +int r = 0; +#pragma omp parallel for reduction(+: r) for (int i = 0; i < argc; ++i) { #pragma omp cancel for + r += i; } // CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( return argc; @@ -163,6 +165,9 @@ for (int i = 0; i < argc; ++i) { // CHECK: [[CONTINUE]] // CHECK: br label // CHECK: call void @__kmpc_for_static_fini( +// CHECK: call i32 @__kmpc_reduce_nowait( +// CHECK: call void @__kmpc_end_reduce_nowait( +// CHECK: call void @__kmpc_for_static_fini( // CHECK: ret void #endif |

