[compiler-rt] 14c1b40 - [compiler-rt] [profile] fix profile generate for mingw x86_64
Martin Storsjö via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 30 13:40:13 PDT 2020
Author: Peiyuan Song
Date: 2020-07-30T23:37:33+03:00
New Revision: 14c1b4017422cbf374086ea4c4fa74e16fb56779
URL: https://github.com/llvm/llvm-project/commit/14c1b4017422cbf374086ea4c4fa74e16fb56779
DIFF: https://github.com/llvm/llvm-project/commit/14c1b4017422cbf374086ea4c4fa74e16fb56779.diff
LOG: [compiler-rt] [profile] fix profile generate for mingw x86_64
Differential Revision: https://reviews.llvm.org/D84757
Added:
Modified:
compiler-rt/lib/profile/CMakeLists.txt
compiler-rt/lib/profile/InstrProfilingPort.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/profile/CMakeLists.txt b/compiler-rt/lib/profile/CMakeLists.txt
index a968009f9ea90..3457bb6444de6 100644
--- a/compiler-rt/lib/profile/CMakeLists.txt
+++ b/compiler-rt/lib/profile/CMakeLists.txt
@@ -1,11 +1,11 @@
CHECK_CXX_SOURCE_COMPILES("
-#ifdef _MSC_VER
-#include <Intrin.h> /* Workaround for PR19898. */
+#ifdef _WIN32
+#include <intrin.h> /* Workaround for PR19898. */
#include <windows.h>
#endif
int main() {
-#ifdef _MSC_VER
+#ifdef _WIN32
volatile LONG val = 1;
MemoryBarrier();
InterlockedCompareExchange(&val, 0, 1);
diff --git a/compiler-rt/lib/profile/InstrProfilingPort.h b/compiler-rt/lib/profile/InstrProfilingPort.h
index 20cf5d660c6ae..4493dd512ff0d 100644
--- a/compiler-rt/lib/profile/InstrProfilingPort.h
+++ b/compiler-rt/lib/profile/InstrProfilingPort.h
@@ -53,9 +53,9 @@
#endif
#if COMPILER_RT_HAS_ATOMICS == 1
-#ifdef _MSC_VER
+#ifdef _WIN32
#include <windows.h>
-#if _MSC_VER < 1900
+#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
#if defined(_WIN64)
@@ -73,7 +73,7 @@
(DomType *)InterlockedExchangeAdd((LONG volatile *)&PtrVar, \
(LONG)sizeof(DomType) * PtrIncr)
#endif
-#else /* !defined(_MSC_VER) */
+#else /* !defined(_WIN32) */
#define COMPILER_RT_BOOL_CMPXCHG(Ptr, OldV, NewV) \
__sync_bool_compare_and_swap(Ptr, OldV, NewV)
#define COMPILER_RT_PTR_FETCH_ADD(DomType, PtrVar, PtrIncr) \
More information about the llvm-commits
mailing list