From owner-svn-src-all@freebsd.org Fri Jan 22 21:17:14 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D7F0A8EA18; Fri, 22 Jan 2016 21:17:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 568C41351; Fri, 22 Jan 2016 21:17:14 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0MLHDdb026944; Fri, 22 Jan 2016 21:17:13 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0MLHCoc026938; Fri, 22 Jan 2016 21:17:12 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201601222117.u0MLHCoc026938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 22 Jan 2016 21:17:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r294604 - in vendor/clang/dist: lib/CodeGen lib/Sema test/OpenMP test/SemaTemplate X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Jan 2016 21:17:14 -0000 Author: dim Date: Fri Jan 22 21:17:12 2016 New Revision: 294604 URL: https://svnweb.freebsd.org/changeset/base/294604 Log: Vendor import of clang release_38 branch r258549: https://llvm.org/svn/llvm-project/cfe/branches/release_38@258549 Modified: vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp vendor/clang/dist/lib/CodeGen/CodeGenFunction.h vendor/clang/dist/lib/Sema/SemaTemplate.cpp vendor/clang/dist/test/OpenMP/parallel_reduction_codegen.cpp vendor/clang/dist/test/SemaTemplate/default-arguments.cpp Modified: vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp Fri Jan 22 21:16:50 2016 (r294603) +++ vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp Fri Jan 22 21:17:12 2016 (r294604) @@ -3548,14 +3548,16 @@ void CGOpenMPRuntime::emitReduction(Code E = CGF.EmitAnyExpr(EExpr); CGF.EmitOMPAtomicSimpleUpdateExpr( X, E, BO, /*IsXLHSInRHSPart=*/true, llvm::Monotonic, Loc, - [&CGF, UpExpr, VD, IPriv](RValue XRValue) { + [&CGF, UpExpr, VD, IPriv, Loc](RValue XRValue) { CodeGenFunction::OMPPrivateScope PrivateScope(CGF); - PrivateScope.addPrivate(VD, [&CGF, VD, XRValue]() -> Address { - Address LHSTemp = CGF.CreateMemTemp(VD->getType()); - CGF.EmitStoreThroughLValue( - XRValue, CGF.MakeAddrLValue(LHSTemp, VD->getType())); - return LHSTemp; - }); + PrivateScope.addPrivate( + VD, [&CGF, VD, XRValue, Loc]() -> Address { + Address LHSTemp = CGF.CreateMemTemp(VD->getType()); + CGF.emitOMPSimpleStore( + CGF.MakeAddrLValue(LHSTemp, VD->getType()), XRValue, + VD->getType().getNonReferenceType(), Loc); + return LHSTemp; + }); (void)PrivateScope.Privatize(); return CGF.EmitAnyExpr(UpExpr); }); Modified: vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp ============================================================================== --- vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp Fri Jan 22 21:16:50 2016 (r294603) +++ vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp Fri Jan 22 21:17:12 2016 (r294604) @@ -2163,17 +2163,17 @@ static void emitSimpleAtomicStore(CodeGe } } -static void emitSimpleStore(CodeGenFunction &CGF, LValue LVal, RValue RVal, - QualType RValTy, SourceLocation Loc) { - switch (CGF.getEvaluationKind(LVal.getType())) { +void CodeGenFunction::emitOMPSimpleStore(LValue LVal, RValue RVal, + QualType RValTy, SourceLocation Loc) { + switch (getEvaluationKind(LVal.getType())) { case TEK_Scalar: - CGF.EmitStoreThroughLValue(RValue::get(convertToScalarValue( - CGF, RVal, RValTy, LVal.getType(), Loc)), - LVal); + EmitStoreThroughLValue(RValue::get(convertToScalarValue( + *this, RVal, RValTy, LVal.getType(), Loc)), + LVal); break; case TEK_Complex: - CGF.EmitStoreOfComplex( - convertToComplexValue(CGF, RVal, RValTy, LVal.getType(), Loc), LVal, + EmitStoreOfComplex( + convertToComplexValue(*this, RVal, RValTy, LVal.getType(), Loc), LVal, /*isInit=*/false); break; case TEK_Aggregate: @@ -2201,7 +2201,7 @@ static void EmitOMPAtomicReadExpr(CodeGe // list. if (IsSeqCst) CGF.CGM.getOpenMPRuntime().emitFlush(CGF, llvm::None, Loc); - emitSimpleStore(CGF, VLValue, Res, X->getType().getNonReferenceType(), Loc); + CGF.emitOMPSimpleStore(VLValue, Res, X->getType().getNonReferenceType(), Loc); } static void EmitOMPAtomicWriteExpr(CodeGenFunction &CGF, bool IsSeqCst, @@ -2459,7 +2459,7 @@ static void EmitOMPAtomicCaptureExpr(Cod } } // Emit post-update store to 'v' of old/new 'x' value. - emitSimpleStore(CGF, VLValue, NewVVal, NewVValType, Loc); + CGF.emitOMPSimpleStore(VLValue, NewVVal, NewVValType, Loc); // OpenMP, 2.12.6, atomic Construct // Any atomic construct with a seq_cst clause forces the atomically // performed operation to include an implicit flush operation without a Modified: vendor/clang/dist/lib/CodeGen/CodeGenFunction.h ============================================================================== --- vendor/clang/dist/lib/CodeGen/CodeGenFunction.h Fri Jan 22 21:16:50 2016 (r294603) +++ vendor/clang/dist/lib/CodeGen/CodeGenFunction.h Fri Jan 22 21:17:12 2016 (r294604) @@ -2211,6 +2211,8 @@ public: llvm::Function *GenerateOpenMPCapturedStmtFunction(const CapturedStmt &S); void GenerateOpenMPCapturedVars(const CapturedStmt &S, SmallVectorImpl &CapturedVars); + void emitOMPSimpleStore(LValue LVal, RValue RVal, QualType RValTy, + SourceLocation Loc); /// \brief Perform element by element copying of arrays with type \a /// OriginalType from \a SrcAddr to \a DestAddr using copying procedure /// generated by \a CopyGen. Modified: vendor/clang/dist/lib/Sema/SemaTemplate.cpp ============================================================================== --- vendor/clang/dist/lib/Sema/SemaTemplate.cpp Fri Jan 22 21:16:50 2016 (r294603) +++ vendor/clang/dist/lib/Sema/SemaTemplate.cpp Fri Jan 22 21:17:12 2016 (r294604) @@ -3281,7 +3281,6 @@ SubstDefaultTemplateArgument(Sema &SemaR for (unsigned i = 0, e = Param->getDepth(); i != e; ++i) TemplateArgLists.addOuterTemplateArguments(None); - Sema::ContextRAII SavedContext(SemaRef, Template->getDeclContext()); EnterExpressionEvaluationContext ConstantEvaluated(SemaRef, Sema::ConstantEvaluated); return SemaRef.SubstExpr(Param->getDefaultArgument(), TemplateArgLists); Modified: vendor/clang/dist/test/OpenMP/parallel_reduction_codegen.cpp ============================================================================== --- vendor/clang/dist/test/OpenMP/parallel_reduction_codegen.cpp Fri Jan 22 21:16:50 2016 (r294603) +++ vendor/clang/dist/test/OpenMP/parallel_reduction_codegen.cpp Fri Jan 22 21:17:12 2016 (r294604) @@ -158,6 +158,7 @@ int main() { int vec[] = {1, 2}; S s_arr[] = {1, 2}; S var(3), var1; + float _Complex cf; #pragma omp parallel reduction(+:t_var) reduction(&:var) reduction(&& : var1) reduction(min: t_var1) { vec[0] = t_var; @@ -169,6 +170,8 @@ int main() { vec[0] = t_var; s_arr[0] = var; } +#pragma omp parallel reduction(+ : cf) + ; return tmain(); #endif } @@ -178,6 +181,7 @@ int main() { // CHECK: call {{.*}} [[S_FLOAT_TY_CONSTR:@.+]]([[S_FLOAT_TY]]* [[TEST]]) // CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 6, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [2 x i32]*, float*, [2 x [[S_FLOAT_TY]]]*, [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]*, float*)* [[MAIN_MICROTASK:@.+]] to void // CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 6, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [2 x i32]*, float*, [2 x [[S_FLOAT_TY]]]*, [[S_FLOAT_TY]]*, [[S_FLOAT_TY]]*, float*)* [[MAIN_MICROTASK1:@.+]] to void +// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, { float, float }*)* [[MAIN_MICROTASK2:@.+]] to void // CHECK: = call {{.*}}i{{.+}} [[TMAIN_INT:@.+]]() // CHECK: call {{.*}} [[S_FLOAT_TY_DESTR:@.+]]([[S_FLOAT_TY]]* // CHECK: ret Modified: vendor/clang/dist/test/SemaTemplate/default-arguments.cpp ============================================================================== --- vendor/clang/dist/test/SemaTemplate/default-arguments.cpp Fri Jan 22 21:16:50 2016 (r294603) +++ vendor/clang/dist/test/SemaTemplate/default-arguments.cpp Fri Jan 22 21:17:12 2016 (r294604) @@ -179,3 +179,31 @@ struct C { C(T t = ); // expected-error {{expected expression}} }; C obj; + +namespace PR26134 { +// Make sure when substituting default template arguments we do it in the current context. +template +struct X {}; + +template struct Y { + void f() { X xy; } + static const bool value = B; +}; + +namespace ns1 { +template +struct X { + template struct XInner { static const bool value = B; }; +}; +template struct S { static const bool value = B; }; +#if __cplusplus > 199711L +template struct Y { + static constexpr bool f() { return typename X>::template XInner<>{}.value; } + static_assert(f() == B, ""); +}; +Y y; +Y y2; +#endif + +} // end ns1 +} // end ns PR26134