diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2017-10-17 16:47:34 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2017-10-17 16:47:34 +0000 |
commit | 7ba57afd6efd57b68a2cefebdb0393669c38d287 (patch) | |
tree | 38ce8432f8f1bf6ea209572ccd401d7814e03c15 /clang/lib/CodeGen/CGStmtOpenMP.cpp | |
parent | c596e9088fffd325918f1b87929dc1159750d02b (diff) | |
download | bcm5719-llvm-7ba57afd6efd57b68a2cefebdb0393669c38d287.tar.gz bcm5719-llvm-7ba57afd6efd57b68a2cefebdb0393669c38d287.zip |
[OPENMP] Fix capturing of boolean variables in debug mode.
If the variables is boolean and we generating inner function with real
types, the codegen may crash because of not loading boolean value from
memory.
llvm-svn: 316011
Diffstat (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGStmtOpenMP.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp index 66d248d6ff0..cdec3e35f97 100644 --- a/clang/lib/CodeGen/CGStmtOpenMP.cpp +++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp @@ -501,9 +501,10 @@ CodeGenFunction::GenerateOpenMPCapturedStmtFunction(const CapturedStmt &S) { llvm::Value *CallArg; auto I = LocalAddrs.find(Arg); if (I != LocalAddrs.end()) { - LValue LV = - WrapperCGF.MakeAddrLValue(I->second.second, Arg->getType(), - AlignmentSource::Decl); + LValue LV = WrapperCGF.MakeAddrLValue( + I->second.second, + I->second.first ? I->second.first->getType() : Arg->getType(), + AlignmentSource::Decl); CallArg = WrapperCGF.EmitLoadOfScalar(LV, SourceLocation()); } else { auto EI = VLASizes.find(Arg); @@ -516,7 +517,7 @@ CodeGenFunction::GenerateOpenMPCapturedStmtFunction(const CapturedStmt &S) { CallArg = WrapperCGF.EmitLoadOfScalar(LV, SourceLocation()); } } - CallArgs.emplace_back(CallArg); + CallArgs.emplace_back(WrapperCGF.EmitFromMemory(CallArg, Arg->getType())); } CGM.getOpenMPRuntime().emitOutlinedFunctionCall(WrapperCGF, S.getLocStart(), F, CallArgs); |