Author: abataev Date: Thu Jul 7 06:04:06 2016 New Revision: 274745 URL: http://llvm.org/viewvc/llvm-project?rev=274745&view=rev Log: [OPENMP] Do not create helper expressions in dependent contexts, NFC.
OpenMP relies on some helper expressions generated during semantic analysis. But they are required only for codegen and not required in dependent contexts. Patch removes generation of some of helper expressions. Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=274745&r1=274744&r2=274745&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original) +++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu Jul 7 06:04:06 2016 @@ -4380,6 +4380,8 @@ bool OpenMPIterationSpaceChecker::CheckI static ExprResult tryBuildCapture(Sema &SemaRef, Expr *Capture, llvm::MapVector<Expr *, DeclRefExpr *> &Captures) { + if (SemaRef.CurContext->isDependentContext()) + return ExprResult(Capture); if (Capture->isEvaluatable(SemaRef.Context, Expr::SE_AllowSideEffects)) return SemaRef.PerformImplicitConversion( Capture->IgnoreImpCasts(), Capture->getType(), Sema::AA_Converting, @@ -8224,10 +8226,12 @@ OMPClause *Sema::ActOnOpenMPPrivateClaus *this, VDPrivate, RefExpr->getType().getUnqualifiedType(), ELoc); DeclRefExpr *Ref = nullptr; - if (!VD) + if (!VD && !CurContext->isDependentContext()) Ref = buildCapture(*this, D, SimpleRefExpr, /*WithInit=*/false); DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_private, Ref); - Vars.push_back(VD ? RefExpr->IgnoreParens() : Ref); + Vars.push_back((VD || CurContext->isDependentContext()) + ? RefExpr->IgnoreParens() + : Ref); PrivateCopies.push_back(VDPrivateRefExpr); } @@ -8522,7 +8526,7 @@ OMPClause *Sema::ActOnOpenMPFirstprivate *this, VDPrivate, RefExpr->getType().getUnqualifiedType(), RefExpr->getExprLoc()); DeclRefExpr *Ref = nullptr; - if (!VD) { + if (!VD && !CurContext->isDependentContext()) { if (TopDVar.CKind == OMPC_lastprivate) Ref = TopDVar.PrivateCopy; else { @@ -8532,7 +8536,9 @@ OMPClause *Sema::ActOnOpenMPFirstprivate } } DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_firstprivate, Ref); - Vars.push_back(VD ? RefExpr->IgnoreParens() : Ref); + Vars.push_back((VD || CurContext->isDependentContext()) + ? RefExpr->IgnoreParens() + : Ref); PrivateCopies.push_back(VDPrivateRefExpr); Inits.push_back(VDInitRefExpr); } @@ -8661,7 +8667,7 @@ OMPClause *Sema::ActOnOpenMPLastprivateC continue; DeclRefExpr *Ref = nullptr; - if (!VD) { + if (!VD && !CurContext->isDependentContext()) { if (TopDVar.CKind == OMPC_firstprivate) Ref = TopDVar.PrivateCopy; else { @@ -8685,7 +8691,9 @@ OMPClause *Sema::ActOnOpenMPLastprivateC } } DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_lastprivate, Ref); - Vars.push_back(VD ? RefExpr->IgnoreParens() : Ref); + Vars.push_back((VD || CurContext->isDependentContext()) + ? RefExpr->IgnoreParens() + : Ref); SrcExprs.push_back(PseudoSrcExpr); DstExprs.push_back(PseudoDstExpr); AssignmentOps.push_back(AssignmentOp.get()); @@ -8737,10 +8745,12 @@ OMPClause *Sema::ActOnOpenMPSharedClause } DeclRefExpr *Ref = nullptr; - if (!VD && IsOpenMPCapturedDecl(D)) + if (!VD && IsOpenMPCapturedDecl(D) && !CurContext->isDependentContext()) Ref = buildCapture(*this, D, SimpleRefExpr, /*WithInit=*/true); DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_shared, Ref); - Vars.push_back((VD || !Ref) ? RefExpr->IgnoreParens() : Ref); + Vars.push_back((VD || !Ref || CurContext->isDependentContext()) + ? RefExpr->IgnoreParens() + : Ref); } if (Vars.empty()) @@ -9421,7 +9431,7 @@ OMPClause *Sema::ActOnOpenMPReductionCla DeclRefExpr *Ref = nullptr; Expr *VarsExpr = RefExpr->IgnoreParens(); - if (!VD) { + if (!VD && !CurContext->isDependentContext()) { if (ASE || OASE) { TransformExprToCaptures RebuildToCapture(*this, D); VarsExpr = @@ -9579,7 +9589,7 @@ OMPClause *Sema::ActOnOpenMPLinearClause VarDecl *Init = buildVarDecl(*this, ELoc, Type, ".linear.start"); Expr *InitExpr; DeclRefExpr *Ref = nullptr; - if (!VD) { + if (!VD && !CurContext->isDependentContext()) { Ref = buildCapture(*this, D, SimpleRefExpr, /*WithInit=*/false); if (!IsOpenMPCapturedDecl(D)) { ExprCaptures.push_back(Ref->getDecl()); @@ -9606,7 +9616,9 @@ OMPClause *Sema::ActOnOpenMPLinearClause auto InitRef = buildDeclRefExpr(*this, Init, Type, ELoc); DSAStack->addDSA(D, RefExpr->IgnoreParens(), OMPC_linear, Ref); - Vars.push_back(VD ? RefExpr->IgnoreParens() : Ref); + Vars.push_back((VD || CurContext->isDependentContext()) + ? RefExpr->IgnoreParens() + : Ref); Privates.push_back(PrivateRef); Inits.push_back(InitRef); } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits