diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2018-07-09 17:43:58 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2018-07-09 17:43:58 +0000 |
commit | b99dcb5f31049381a7ca29def6edeb48da3217b0 (patch) | |
tree | a82991801b46b40459cac79a512640dc455708ad /clang/lib | |
parent | 47170b3153a4a494bbfd76d31e2fbb754dda34ec (diff) | |
download | bcm5719-llvm-b99dcb5f31049381a7ca29def6edeb48da3217b0.tar.gz bcm5719-llvm-b99dcb5f31049381a7ca29def6edeb48da3217b0.zip |
[OPENMP, NVPTX] Do not globalize local variables in parallel regions.
In generic data-sharing mode we are allowed to not globalize local
variables that escape their declaration context iff they are declared
inside of the parallel region. We can do this because L2 parallel
regions are executed sequentially and, thus, we do not need to put
shared local variables in the global memory.
llvm-svn: 336567
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp index 8cf5bb2f44b..0ef093fd057 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp @@ -1554,29 +1554,22 @@ void CGOpenMPRuntimeNVPTX::emitNumTeamsClause(CodeGenFunction &CGF, llvm::Value *CGOpenMPRuntimeNVPTX::emitParallelOutlinedFunction( const OMPExecutableDirective &D, const VarDecl *ThreadIDVar, OpenMPDirectiveKind InnermostKind, const RegionCodeGenTy &CodeGen) { - SourceLocation Loc = D.getLocStart(); - // Emit target region as a standalone region. class NVPTXPrePostActionTy : public PrePostActionTy { - SourceLocation &Loc; bool &IsInParallelRegion; bool PrevIsInParallelRegion; public: - NVPTXPrePostActionTy(SourceLocation &Loc, bool &IsInParallelRegion) - : Loc(Loc), IsInParallelRegion(IsInParallelRegion) {} + NVPTXPrePostActionTy(bool &IsInParallelRegion) + : IsInParallelRegion(IsInParallelRegion) {} void Enter(CodeGenFunction &CGF) override { - static_cast<CGOpenMPRuntimeNVPTX &>(CGF.CGM.getOpenMPRuntime()) - .emitGenericVarsProlog(CGF, Loc); PrevIsInParallelRegion = IsInParallelRegion; IsInParallelRegion = true; } void Exit(CodeGenFunction &CGF) override { IsInParallelRegion = PrevIsInParallelRegion; - static_cast<CGOpenMPRuntimeNVPTX &>(CGF.CGM.getOpenMPRuntime()) - .emitGenericVarsEpilog(CGF); } - } Action(Loc, IsInParallelRegion); + } Action(IsInParallelRegion); CodeGen.setAction(Action); bool PrevIsInTargetMasterThreadRegion = IsInTargetMasterThreadRegion; IsInTargetMasterThreadRegion = false; |