diff options
author | Erich Keane <erich.keane@intel.com> | 2017-07-27 16:28:20 +0000 |
---|---|---|
committer | Erich Keane <erich.keane@intel.com> | 2017-07-27 16:28:20 +0000 |
commit | 0026ed2f9cc73e60bbfb1d84b8906a8d4ffb8e96 (patch) | |
tree | d0c28a5e6e51daa65494856608b91d0f0573b71c /clang/lib/CodeGen/CodeGenFunction.h | |
parent | 67ddd1d08f3d3e702ac41b34f91d3047eee4460a (diff) | |
download | bcm5719-llvm-0026ed2f9cc73e60bbfb1d84b8906a8d4ffb8e96.tar.gz bcm5719-llvm-0026ed2f9cc73e60bbfb1d84b8906a8d4ffb8e96.zip |
Fix double destruction of objects when OpenMP construct is canceled
When an omp for loop is canceled the constructed objects are being destructed
twice.
It looks like the desired code is:
{
Obj o;
If (cancelled) branch-through-cleanups to cancel.exit.
}
[cleanups]
cancel.exit:
__kmpc_for_static_fini
br cancel.cont (*)
cancel.cont:
__kmpc_barrier
return
The problem seems to be the branch to cancel.cont is currently also going
through the cleanups calling them again. This change just does a direct branch
instead.
Patch By: michael.p.rice@intel.com
Differential Revision: https://reviews.llvm.org/D35854
llvm-svn: 309288
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 2e31be8c686..fed92a41a94 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -1116,7 +1116,7 @@ private: auto IP = CGF.Builder.saveAndClearIP(); CGF.EmitBlock(Stack.back().ExitBlock.getBlock()); CodeGen(CGF); - CGF.EmitBranchThroughCleanup(Stack.back().ContBlock); + CGF.EmitBranch(Stack.back().ContBlock.getBlock()); CGF.Builder.restoreIP(IP); Stack.back().HasBeenEmitted = true; } |