From b99dcb5f31049381a7ca29def6edeb48da3217b0 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Mon, 9 Jul 2018 17:43:58 +0000 Subject: [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 --- clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'clang/lib/CodeGen') 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(CGF.CGM.getOpenMPRuntime()) - .emitGenericVarsProlog(CGF, Loc); PrevIsInParallelRegion = IsInParallelRegion; IsInParallelRegion = true; } void Exit(CodeGenFunction &CGF) override { IsInParallelRegion = PrevIsInParallelRegion; - static_cast(CGF.CGM.getOpenMPRuntime()) - .emitGenericVarsEpilog(CGF); } - } Action(Loc, IsInParallelRegion); + } Action(IsInParallelRegion); CodeGen.setAction(Action); bool PrevIsInTargetMasterThreadRegion = IsInTargetMasterThreadRegion; IsInTargetMasterThreadRegion = false; -- cgit v1.2.3