[llvm] r215744 - Fix the build with MSVC 2013 after new shuffle code

Reid Kleckner reid at kleckner.net
Fri Aug 15 11:03:58 PDT 2014


Author: rnk
Date: Fri Aug 15 13:03:58 2014
New Revision: 215744

URL: http://llvm.org/viewvc/llvm-project?rev=215744&view=rev
Log:
Fix the build with MSVC 2013 after new shuffle code

MSVC gives this awesome diagnostic:

..\lib\Target\X86\X86ISelLowering.cpp(7085) : error C2971: 'llvm::VariadicFunction1' : template parameter 'Func' : 'isShuffleEquivalentImpl' : a local variable cannot be used as a non-type argument
        ..\include\llvm/ADT/VariadicFunction.h(153) : see declaration of 'llvm::VariadicFunction1'
        ..\lib\Target\X86\X86ISelLowering.cpp(7061) : see declaration of 'isShuffleEquivalentImpl'

Using an anonymous namespace makes the problem go away.

Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=215744&r1=215743&r2=215744&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Fri Aug 15 13:03:58 2014
@@ -7055,11 +7055,14 @@ static bool isSingleInputShuffleMask(Arr
   return true;
 }
 
+// Hide this symbol with an anonymous namespace instead of 'static' so that MSVC
+// 2013 will allow us to use it as a non-type template parameter.
+namespace {
+
 /// \brief Implementation of the \c isShuffleEquivalent variadic functor.
 ///
 /// See its documentation for details.
-static bool isShuffleEquivalentImpl(ArrayRef<int> Mask,
-                                    ArrayRef<const int *> Args) {
+bool isShuffleEquivalentImpl(ArrayRef<int> Mask, ArrayRef<const int *> Args) {
   if (Mask.size() != Args.size())
     return false;
   for (int i = 0, e = Mask.size(); i < e; ++i) {
@@ -7071,6 +7074,9 @@ static bool isShuffleEquivalentImpl(Arra
   }
   return true;
 }
+
+} // namespace
+
 /// \brief Checks whether a shuffle mask is equivalent to an explicit list of
 /// arguments.
 ///





More information about the llvm-commits mailing list