Don't use posix_memalign on Windows platforms

llvm-svn: 290448
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 3e8353724b8ef7e04c1ff1e0bad40a9d4233865b
diff --git a/src/new.cpp b/src/new.cpp
index 1465bcd..3d8b2a9 100644
--- a/src/new.cpp
+++ b/src/new.cpp
@@ -70,7 +70,11 @@
     if (static_cast<size_t>(alignment) < sizeof(void*))
       alignment = std::align_val_t(sizeof(void*));
     void* p;
+#if defined(_WIN32)
+    while ((p = _aligned_malloc(size, static_cast<size_t>(alignment))) == nullptr)
+#else
     while (::posix_memalign(&p, static_cast<size_t>(alignment), size) != 0)
+#endif
     {
         // If posix_memalign fails and there is a new_handler,
         // call it to try free up memory.