diff options
| author | Alexey Bataev <a.bataev@hotmail.com> | 2016-12-22 19:44:05 +0000 |
|---|---|---|
| committer | Alexey Bataev <a.bataev@hotmail.com> | 2016-12-22 19:44:05 +0000 |
| commit | 5e87c3465ec262cab99f1f832e0be1d0076c201c (patch) | |
| tree | b0dcce601ab164c39992c47e86c9559559afbe32 /clang/lib/CodeGen | |
| parent | f3f01aba48188c06d267aa270bdcc5f2eb502caf (diff) | |
| download | bcm5719-llvm-5e87c3465ec262cab99f1f832e0be1d0076c201c.tar.gz bcm5719-llvm-5e87c3465ec262cab99f1f832e0be1d0076c201c.zip | |
[OPENMP] Fix for PR31417: assert failure when compiling trivial openmp
program
Offload related code is not quite ready yet, but some simple examples
must not crash the compiler. Patch fixes the problem in offloading code
with exceptions.
llvm-svn: 290364
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp | 4 | ||||
| -rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.h | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp index d64f6df7201..af8903b7c73 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp @@ -244,6 +244,9 @@ void CGOpenMPRuntimeNVPTX::emitEntryHeader(CodeGenFunction &CGF, void CGOpenMPRuntimeNVPTX::emitEntryFooter(CodeGenFunction &CGF, EntryFunctionState &EST) { + if (!EST.ExitBB) + EST.ExitBB = CGF.createBasicBlock(".exit"); + CGBuilderTy &Bld = CGF.Builder; llvm::BasicBlock *TerminateBB = CGF.createBasicBlock(".termination.notifier"); CGF.EmitBranch(TerminateBB); @@ -259,6 +262,7 @@ void CGOpenMPRuntimeNVPTX::emitEntryFooter(CodeGenFunction &CGF, CGF.EmitBranch(EST.ExitBB); CGF.EmitBlock(EST.ExitBB); + EST.ExitBB = nullptr; } /// \brief Returns specified OpenMP runtime function for the current OpenMP diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.h b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.h index a6c64b2f6d6..e18d28cdda9 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.h +++ b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.h @@ -25,11 +25,8 @@ namespace CodeGen { class CGOpenMPRuntimeNVPTX : public CGOpenMPRuntime { public: - class EntryFunctionState { - public: - llvm::BasicBlock *ExitBB; - - EntryFunctionState() : ExitBB(nullptr){}; + struct EntryFunctionState { + llvm::BasicBlock *ExitBB = nullptr; }; class WorkerFunctionState { |

