Index: include/llvm/ADT/FunctionExtras.h =================================================================== --- include/llvm/ADT/FunctionExtras.h +++ include/llvm/ADT/FunctionExtras.h @@ -147,12 +147,19 @@ StorageUnion.OutOfLineStorage = {Ptr, Size, Alignment}; } +#if defined(_MSC_VER) && defined(__clang__) + // The MS ABI does not align functions, but clang can do it. +#define ALIGNED __attribute__((aligned(16))) +#else +#define ALIGNED +#endif template static ReturnT CallImpl(void *CallableAddr, - AdjustedParamT... Params) { + AdjustedParamT... Params) ALIGNED { return (*reinterpret_cast(CallableAddr))( std::forward(Params)...); } +#undef ALIGNED template static void MoveImpl(void *LHSCallableAddr, void *RHSCallableAddr) noexcept { @@ -243,7 +250,7 @@ // Now move into the storage. new (CallableAddr) CallableT(std::move(Callable)); -#ifndef _MSC_VER +#if defined(_MSC_VER) && !defined(__clang__) // See if we can create a trivial callback. // // This requires two things. First, we need to put a function pointer into @@ -252,9 +259,6 @@ // allows this to work, but on some platforms this appears to not hold, and // so we need to disable this optimization on those platforms. // - // FIXME: Currently, Windows appears to fail the asserts that check this. - // We should investigate why, and if fixed removed the #ifndef above. - // // Second, we need the callable to be trivially moved and trivially // destroyed so that we don't have to store type erased callbacks for those // operations.