Re: [llvm-branch-commits] [llvm-branch] r257836 - Merging r257791:

2016-01-22 Thread Daniel Sanders via llvm-branch-commits
Hi Hans,

This change also stops it exporting the test-suite. Could we keep the 'svn 
export' but prevent the build by not creating the llvm.src/projects/test-suite 
symlink?
It's not a problem to export it manually but I thought I might as well ask.

> -Original Message-
> From: llvm-branch-commits [mailto:llvm-branch-commits-
> [email protected]] On Behalf Of Hans Wennborg via llvm-branch-
> commits
> Sent: 14 January 2016 23:24
> To: [email protected]
> Subject: [llvm-branch-commits] [llvm-branch] r257836 - Merging r257791:
> 
> Author: hans
> Date: Thu Jan 14 17:24:17 2016
> New Revision: 257836
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=257836&view=rev
> Log:
> Merging r257791:
> 
> r257791 | hans | 2016-01-14 11:21:14 -0800 (Thu, 14 Jan 2016) | 4 lines
> 
> Exclude test-suite from CMake builds in test-release.sh
> 
> It's broken. In 3.7 there wasn't a CMake build for test-suite at all,
> so we're not losing something we had before.
> 
> 
> Modified:
> llvm/branches/release_38/   (props changed)
> llvm/branches/release_38/utils/release/test-release.sh
> 
> Propchange: llvm/branches/release_38/
> --
> --- svn:mergeinfo (original)
> +++ svn:mergeinfo Thu Jan 14 17:24:17 2016
> @@ -1,3 +1,3 @@
>  /llvm/branches/Apple/Pertwee:110850,110961
>  /llvm/branches/type-system-rewrite:133420-134817
> -/llvm/trunk:155241,257645,257648,257730
> +/llvm/trunk:155241,257645,257648,257730,257791
> 
> Modified: llvm/branches/release_38/utils/release/test-release.sh
> URL: http://llvm.org/viewvc/llvm-
> project/llvm/branches/release_38/utils/release/test-
> release.sh?rev=257836&r1=257835&r2=257836&view=diff
> ==
> 
> --- llvm/branches/release_38/utils/release/test-release.sh (original)
> +++ llvm/branches/release_38/utils/release/test-release.sh Thu Jan 14
> 17:24:17 2016
> @@ -159,6 +159,12 @@ while [ $# -gt 0 ]; do
>  shift
>  done
> 
> +if [ "$use_autoconf" = "no" ]; then
> +  # See llvm.org/PR26146.
> +  echo Skipping test-suite when using CMake.
> +  do_test_suite="no"
> +fi
> +
>  # Check required arguments.
>  if [ -z "$Release" ]; then
>  echo "error: no release number specified"
> 
> 
> ___
> llvm-branch-commits mailing list
> [email protected]
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
___
llvm-branch-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


Re: [llvm-branch-commits] [llvm-branch] r257836 - Merging r257791:

2016-01-22 Thread Daniel Sanders via llvm-branch-commits
Sure. I'll put a patch together.

> -Original Message-
> From: [email protected] [mailto:[email protected]] On Behalf
> Of Hans Wennborg
> Sent: 22 January 2016 16:37
> To: Daniel Sanders; [email protected]
> Subject: Re: [llvm-branch-commits] [llvm-branch] r257836 - Merging r257791:
> 
> Hmm, so Dimitry changed the script in r258436 to export all the
> projects in the right place and stop doing symlinks. I suppose we
> could still export test-suite on the side though. Do you want to send
> me a patch for that?
> 
> Thanks,
> Hans
> 
> On Fri, Jan 22, 2016 at 5:17 AM, Daniel Sanders via
> llvm-branch-commits  wrote:
> > Hi Hans,
> >
> > This change also stops it exporting the test-suite. Could we keep the 'svn
> export' but prevent the build by not creating the llvm.src/projects/test-suite
> symlink?
> > It's not a problem to export it manually but I thought I might as well ask.
> >
> >> -Original Message-
> >> From: llvm-branch-commits [mailto:llvm-branch-commits-
> >> [email protected]] On Behalf Of Hans Wennborg via llvm-branch-
> >> commits
> >> Sent: 14 January 2016 23:24
> >> To: [email protected]
> >> Subject: [llvm-branch-commits] [llvm-branch] r257836 - Merging r257791:
> >>
> >> Author: hans
> >> Date: Thu Jan 14 17:24:17 2016
> >> New Revision: 257836
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=257836&view=rev
> >> Log:
> >> Merging r257791:
> >> 
> >> r257791 | hans | 2016-01-14 11:21:14 -0800 (Thu, 14 Jan 2016) | 4 lines
> >>
> >> Exclude test-suite from CMake builds in test-release.sh
> >>
> >> It's broken. In 3.7 there wasn't a CMake build for test-suite at all,
> >> so we're not losing something we had before.
> >> 
> >>
> >> Modified:
> >> llvm/branches/release_38/   (props changed)
> >> llvm/branches/release_38/utils/release/test-release.sh
> >>
> >> Propchange: llvm/branches/release_38/
> >> --
> >> --- svn:mergeinfo (original)
> >> +++ svn:mergeinfo Thu Jan 14 17:24:17 2016
> >> @@ -1,3 +1,3 @@
> >>  /llvm/branches/Apple/Pertwee:110850,110961
> >>  /llvm/branches/type-system-rewrite:133420-134817
> >> -/llvm/trunk:155241,257645,257648,257730
> >> +/llvm/trunk:155241,257645,257648,257730,257791
> >>
> >> Modified: llvm/branches/release_38/utils/release/test-release.sh
> >> URL: http://llvm.org/viewvc/llvm-
> >> project/llvm/branches/release_38/utils/release/test-
> >> release.sh?rev=257836&r1=257835&r2=257836&view=diff
> >>
> ==
> >> 
> >> --- llvm/branches/release_38/utils/release/test-release.sh (original)
> >> +++ llvm/branches/release_38/utils/release/test-release.sh Thu Jan 14
> >> 17:24:17 2016
> >> @@ -159,6 +159,12 @@ while [ $# -gt 0 ]; do
> >>  shift
> >>  done
> >>
> >> +if [ "$use_autoconf" = "no" ]; then
> >> +  # See llvm.org/PR26146.
> >> +  echo Skipping test-suite when using CMake.
> >> +  do_test_suite="no"
> >> +fi
> >> +
> >>  # Check required arguments.
> >>  if [ -z "$Release" ]; then
> >>  echo "error: no release number specified"
> >>
> >>
> >> ___
> >> llvm-branch-commits mailing list
> >> [email protected]
> >> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
> > ___
> > llvm-branch-commits mailing list
> > [email protected]
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
___
llvm-branch-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm-branch] r258510 - Merging r257886:

2016-01-22 Thread Hans Wennborg via llvm-branch-commits
Author: hans
Date: Fri Jan 22 12:26:38 2016
New Revision: 258510

URL: http://llvm.org/viewvc/llvm-project?rev=258510&view=rev
Log:
Merging r257886:

r257886 | jamesm | 2016-01-15 02:36:01 -0800 (Fri, 15 Jan 2016) | 3 lines

[CodeGenPrepare] Try and appease sanitizers

dupRetToEnableTailCallOpts(BB) can invalidate BB. It must run *after* we 
iterate across BB!


Modified:
llvm/branches/release_38/   (props changed)
llvm/branches/release_38/lib/CodeGen/CodeGenPrepare.cpp

Propchange: llvm/branches/release_38/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jan 22 12:26:38 2016
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,257645,257648,257730,257775,257791,257875,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258168,258207,258221,258273,258325
+/llvm/trunk:155241,257645,257648,257730,257775,257791,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258168,258207,258221,258273,258325

Modified: llvm/branches/release_38/lib/CodeGen/CodeGenPrepare.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/lib/CodeGen/CodeGenPrepare.cpp?rev=258510&r1=258509&r2=258510&view=diff
==
--- llvm/branches/release_38/lib/CodeGen/CodeGenPrepare.cpp (original)
+++ llvm/branches/release_38/lib/CodeGen/CodeGenPrepare.cpp Fri Jan 22 12:26:38 
2016
@@ -5242,7 +5242,6 @@ bool CodeGenPrepare::optimizeBlock(Basic
 if (ModifiedDT)
   return true;
   }
-  MadeChange |= dupRetToEnableTailCallOpts(&BB);
 
   bool MadeBitReverse = true;
   while (TLI && MadeBitReverse) {
@@ -5254,6 +5253,7 @@ bool CodeGenPrepare::optimizeBlock(Basic
   }
 }
   }
+  MadeChange |= dupRetToEnableTailCallOpts(&BB);
   
   return MadeChange;
 }


___
llvm-branch-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm-branch] r258512 - Merging r258416 and r258428:

2016-01-22 Thread Hans Wennborg via llvm-branch-commits
Author: hans
Date: Fri Jan 22 12:37:31 2016
New Revision: 258512

URL: http://llvm.org/viewvc/llvm-project?rev=258512&view=rev
Log:
Merging r258416 and r258428:


r258416 | spatel | 2016-01-21 10:01:57 -0800 (Thu, 21 Jan 2016) | 2 lines

make helper functions static; NFCI



r258428 | spatel | 2016-01-21 12:19:54 -0800 (Thu, 21 Jan 2016) | 15 lines

[LibCallSimplifier] don't get fooled by a fake fmin()

This is similar to the bug/fix:
https://llvm.org/bugs/show_bug.cgi?id=26211
http://reviews.llvm.org/rL258325

The fmin() test case reveals another bug caused by sloppy
code duplication. It will crash without this patch because
fp128 is a valid floating-point type, but we would think
that we had matched a function that used doubles.

The new helper function can be used to replace similar
checks that are used in several other places in this file.


Modified:
llvm/branches/release_38/   (props changed)
llvm/branches/release_38/include/llvm/Transforms/Utils/SimplifyLibCalls.h
llvm/branches/release_38/lib/Transforms/Utils/SimplifyLibCalls.cpp

llvm/branches/release_38/test/Transforms/InstCombine/double-float-shrink-1.ll

Propchange: llvm/branches/release_38/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jan 22 12:37:31 2016
@@ -1,3 +1,3 @@
 /llvm/branches/Apple/Pertwee:110850,110961
 /llvm/branches/type-system-rewrite:133420-134817
-/llvm/trunk:155241,257645,257648,257730,257775,257791,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258168,258207,258221,258273,258325
+/llvm/trunk:155241,257645,257648,257730,257775,257791,257875,257886,257902,257905,257925,257929-257930,257940,257942,257977,257979,257997,258168,258207,258221,258273,258325,258416,258428

Modified: 
llvm/branches/release_38/include/llvm/Transforms/Utils/SimplifyLibCalls.h
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/include/llvm/Transforms/Utils/SimplifyLibCalls.h?rev=258512&r1=258511&r2=258512&view=diff
==
--- llvm/branches/release_38/include/llvm/Transforms/Utils/SimplifyLibCalls.h 
(original)
+++ llvm/branches/release_38/include/llvm/Transforms/Utils/SimplifyLibCalls.h 
Fri Jan 22 12:37:31 2016
@@ -125,8 +125,6 @@ private:
   Value *optimizeStringMemoryLibCall(CallInst *CI, IRBuilder<> &B);
 
   // Math Library Optimizations
-  Value *optimizeUnaryDoubleFP(CallInst *CI, IRBuilder<> &B, bool 
CheckRetType);
-  Value *optimizeBinaryDoubleFP(CallInst *CI, IRBuilder<> &B);
   Value *optimizeCos(CallInst *CI, IRBuilder<> &B);
   Value *optimizePow(CallInst *CI, IRBuilder<> &B);
   Value *optimizeExp2(CallInst *CI, IRBuilder<> &B);

Modified: llvm/branches/release_38/lib/Transforms/Utils/SimplifyLibCalls.cpp
URL: 
http://llvm.org/viewvc/llvm-project/llvm/branches/release_38/lib/Transforms/Utils/SimplifyLibCalls.cpp?rev=258512&r1=258511&r2=258512&view=diff
==
--- llvm/branches/release_38/lib/Transforms/Utils/SimplifyLibCalls.cpp 
(original)
+++ llvm/branches/release_38/lib/Transforms/Utils/SimplifyLibCalls.cpp Fri Jan 
22 12:37:31 2016
@@ -970,15 +970,34 @@ static Value *valueHasFloatPrecision(Val
   return nullptr;
 }
 
-//===--===//
-// Double -> Float Shrinking Optimizations for Unary Functions like 'floor'
+/// Any floating-point library function that we're trying to simplify will have
+/// a signature of the form: fptype foo(fptype param1, fptype param2, ...).
+/// CheckDoubleTy indicates that 'fptype' must be 'double'.
+static bool matchesFPLibFunctionSignature(const Function *F, unsigned 
NumParams,
+  bool CheckDoubleTy) {
+  FunctionType *FT = F->getFunctionType();
+  if (FT->getNumParams() != NumParams)
+return false;
+
+  // The return type must match what we're looking for.
+  Type *RetTy = FT->getReturnType();
+  if (CheckDoubleTy ? !RetTy->isDoubleTy() : !RetTy->isFloatingPointTy())
+return false;
+
+  // Each parameter must match the return type, and therefore, match every 
other
+  // parameter too.
+  for (const Type *ParamTy : FT->params())
+if (ParamTy != RetTy)
+  return false;
 
-Value *LibCallSimplifier::optimizeUnaryDoubleFP(CallInst *CI, IRBuilder<> &B,
-bool CheckRetType) {
+  return true;
+}
+
+/// Shrink double -> float for unary functions like 'floor'.
+static Value *optimizeUnaryDoubleFP(CallInst *CI, IRBuilder<> &B,
+bool CheckRetTy

Re: [llvm-branch-commits] [llvm-branch] r257836 - Merging r257791:

2016-01-22 Thread Hans Wennborg via llvm-branch-commits
Hmm, so Dimitry changed the script in r258436 to export all the
projects in the right place and stop doing symlinks. I suppose we
could still export test-suite on the side though. Do you want to send
me a patch for that?

Thanks,
Hans

On Fri, Jan 22, 2016 at 5:17 AM, Daniel Sanders via
llvm-branch-commits  wrote:
> Hi Hans,
>
> This change also stops it exporting the test-suite. Could we keep the 'svn 
> export' but prevent the build by not creating the 
> llvm.src/projects/test-suite symlink?
> It's not a problem to export it manually but I thought I might as well ask.
>
>> -Original Message-
>> From: llvm-branch-commits [mailto:llvm-branch-commits-
>> [email protected]] On Behalf Of Hans Wennborg via llvm-branch-
>> commits
>> Sent: 14 January 2016 23:24
>> To: [email protected]
>> Subject: [llvm-branch-commits] [llvm-branch] r257836 - Merging r257791:
>>
>> Author: hans
>> Date: Thu Jan 14 17:24:17 2016
>> New Revision: 257836
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=257836&view=rev
>> Log:
>> Merging r257791:
>> 
>> r257791 | hans | 2016-01-14 11:21:14 -0800 (Thu, 14 Jan 2016) | 4 lines
>>
>> Exclude test-suite from CMake builds in test-release.sh
>>
>> It's broken. In 3.7 there wasn't a CMake build for test-suite at all,
>> so we're not losing something we had before.
>> 
>>
>> Modified:
>> llvm/branches/release_38/   (props changed)
>> llvm/branches/release_38/utils/release/test-release.sh
>>
>> Propchange: llvm/branches/release_38/
>> --
>> --- svn:mergeinfo (original)
>> +++ svn:mergeinfo Thu Jan 14 17:24:17 2016
>> @@ -1,3 +1,3 @@
>>  /llvm/branches/Apple/Pertwee:110850,110961
>>  /llvm/branches/type-system-rewrite:133420-134817
>> -/llvm/trunk:155241,257645,257648,257730
>> +/llvm/trunk:155241,257645,257648,257730,257791
>>
>> Modified: llvm/branches/release_38/utils/release/test-release.sh
>> URL: http://llvm.org/viewvc/llvm-
>> project/llvm/branches/release_38/utils/release/test-
>> release.sh?rev=257836&r1=257835&r2=257836&view=diff
>> ==
>> 
>> --- llvm/branches/release_38/utils/release/test-release.sh (original)
>> +++ llvm/branches/release_38/utils/release/test-release.sh Thu Jan 14
>> 17:24:17 2016
>> @@ -159,6 +159,12 @@ while [ $# -gt 0 ]; do
>>  shift
>>  done
>>
>> +if [ "$use_autoconf" = "no" ]; then
>> +  # See llvm.org/PR26146.
>> +  echo Skipping test-suite when using CMake.
>> +  do_test_suite="no"
>> +fi
>> +
>>  # Check required arguments.
>>  if [ -z "$Release" ]; then
>>  echo "error: no release number specified"
>>
>>
>> ___
>> llvm-branch-commits mailing list
>> [email protected]
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
> ___
> llvm-branch-commits mailing list
> [email protected]
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
___
llvm-branch-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [cfe-branch] r258483 - Merging r258394:

2016-01-22 Thread Alexey Bataev via llvm-branch-commits
Author: abataev
Date: Thu Jan 21 22:07:48 2016
New Revision: 258483

URL: http://llvm.org/viewvc/llvm-project?rev=258483&view=rev
Log:
Merging r258394:

r258394 | abataev | 2016-01-21 15:35:58 +0300 (Thu, 21 Jan 2016) | 3 lines

[OPENMP] Fix crash on reduction for complex variables.
reworked codegen for reduction operation for complex types to avoid crash



Modified:
cfe/branches/release_38/lib/CodeGen/CGOpenMPRuntime.cpp
cfe/branches/release_38/lib/CodeGen/CGStmtOpenMP.cpp
cfe/branches/release_38/lib/CodeGen/CodeGenFunction.h
cfe/branches/release_38/test/OpenMP/parallel_reduction_codegen.cpp

Modified: cfe/branches/release_38/lib/CodeGen/CGOpenMPRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/branches/release_38/lib/CodeGen/CGOpenMPRuntime.cpp?rev=258483&r1=258482&r2=258483&view=diff
==
--- cfe/branches/release_38/lib/CodeGen/CGOpenMPRuntime.cpp (original)
+++ cfe/branches/release_38/lib/CodeGen/CGOpenMPRuntime.cpp Thu Jan 21 22:07:48 
2016
@@ -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: cfe/branches/release_38/lib/CodeGen/CGStmtOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/branches/release_38/lib/CodeGen/CGStmtOpenMP.cpp?rev=258483&r1=258482&r2=258483&view=diff
==
--- cfe/branches/release_38/lib/CodeGen/CGStmtOpenMP.cpp (original)
+++ cfe/branches/release_38/lib/CodeGen/CGStmtOpenMP.cpp Thu Jan 21 22:07:48 
2016
@@ -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: cfe/br

[llvm-branch-commits] [cfe-branch] r258549 - Merging r258110:

2016-01-22 Thread Dimitry Andric via llvm-branch-commits
Author: dim
Date: Fri Jan 22 14:43:39 2016
New Revision: 258549

URL: http://llvm.org/viewvc/llvm-project?rev=258549&view=rev
Log:
Merging r258110:

r258110 | faisalv | 2016-01-19 04:58:55 +0100 (Tue, 19 Jan 2016) | 15 lines

Fix PR26134: When substituting into default template arguments, keep CurContext 
unchanged.

Or, do not set Sema's CurContext to the template declaration's when 
substituting into default template arguments of said template declaration.   
If we do push the template declaration context on to Sema, and the template 
declaration is at namespace scope, Sema can get confused and try and do odr 
analysis when substituting into default template arguments, even though the 
substitution could be occurring within a dependent context.
I'm not sure why this was being done, perhaps there was concern that if a 
default template argument referred to a previous template parameter, it might 
not be found during substitution - but all regression tests pass, and I can't 
craft a test that would cause it to fails (if some one does, please inform me, 
and i'll craft a different fix for the PR).


This patch removes a single line of code, but unfortunately adds more than it 
removes, because of the tests.  Some day I still hope to commit a patch that 
removes far more lines than it adds, while leaving clang better for it ;)

Sorry that r253590 ("Change the expression evaluation context from Unevaluated 
to ConstantEvaluated while substituting into non-type template argument 
defaults") caused the PR!







Modified:
cfe/branches/release_38/   (props changed)
cfe/branches/release_38/lib/Sema/SemaTemplate.cpp
cfe/branches/release_38/test/SemaTemplate/default-arguments.cpp

Propchange: cfe/branches/release_38/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Jan 22 14:43:39 2016
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:257652,257695
+/cfe/trunk:257652,257695,258110
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_38/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/branches/release_38/lib/Sema/SemaTemplate.cpp?rev=258549&r1=258548&r2=258549&view=diff
==
--- cfe/branches/release_38/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/branches/release_38/lib/Sema/SemaTemplate.cpp Fri Jan 22 14:43:39 2016
@@ -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: cfe/branches/release_38/test/SemaTemplate/default-arguments.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/branches/release_38/test/SemaTemplate/default-arguments.cpp?rev=258549&r1=258548&r2=258549&view=diff
==
--- cfe/branches/release_38/test/SemaTemplate/default-arguments.cpp (original)
+++ cfe/branches/release_38/test/SemaTemplate/default-arguments.cpp Fri Jan 22 
14:43:39 2016
@@ -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


___
llvm-branch-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits