diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2016-11-15 09:11:50 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-11-15 09:11:50 +0000 |
| commit | 473a3e7fed16ec27db398047d29082ce6cf9d318 (patch) | |
| tree | 584f7d4a848be53a40d21bc09af776deb47b4517 /clang/test/OpenMP/cancel_codegen.cpp | |
| parent | 53315a7b98dd97f9ead880ecf84906b01e8958d2 (diff) | |
| download | bcm5719-llvm-473a3e7fed16ec27db398047d29082ce6cf9d318.tar.gz bcm5719-llvm-473a3e7fed16ec27db398047d29082ce6cf9d318.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: 286944
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..768d2c0bd7a 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 |

