diff --git a/llvm/include/llvm/Support/RWMutex.h b/llvm/include/llvm/Support/RWMutex.h
--- a/llvm/include/llvm/Support/RWMutex.h
+++ b/llvm/include/llvm/Support/RWMutex.h
@@ -93,8 +93,8 @@
 /// running in multithreaded mode.
 template <bool mt_only> class SmartRWMutex {
   // shared_mutex (C++17) is more efficient than shared_timed_mutex (C++14)
-  // on Windows and always available on MSVC.
-#if defined(_MSC_VER) || __cplusplus > 201402L
+  // on Windows and always available on MSVC except with libc++.
+#if (defined(_MSC_VER) && !defined(_LIBCPP_VERSION)) || __cplusplus > 201402L
   std::shared_mutex impl;
 #else
 #if !defined(LLVM_USE_RW_MUTEX_IMPL)
diff --git a/llvm/lib/Support/NativeFormatting.cpp b/llvm/lib/Support/NativeFormatting.cpp
--- a/llvm/lib/Support/NativeFormatting.cpp
+++ b/llvm/lib/Support/NativeFormatting.cpp
@@ -14,6 +14,10 @@
 #include "llvm/Support/MathExtras.h"
 #include "llvm/Support/raw_ostream.h"
 
+#if defined(_WIN32) && !defined(__MINGW32__)
+#include <float.h> // For _fpclass in llvm::write_double.
+#endif
+
 using namespace llvm;
 
 template<typename T, std::size_t N>
diff --git a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
--- a/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/X86/Target.cpp
@@ -31,6 +31,9 @@
 #include <immintrin.h>
 #include <intrin.h>
 #endif
+#if defined(__x86_64__) && defined(_MSC_VER)
+#include <float.h> // For _clearfp in ~X86SavedState().
+#endif
 
 namespace llvm {
 namespace exegesis {