diff options
author | Eric Fiselier <eric@efcs.ca> | 2017-03-11 00:07:08 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2017-03-11 00:07:08 +0000 |
commit | d2001dac3f99d998b68d24bb2a9a4eb73f5161e7 (patch) | |
tree | 092c15d1a7189b06cc7cd7a52a5735358d1a1e63 | |
parent | c28c7e5bd3439c32cc70cc454bb51a8bfcdd559f (diff) | |
download | llvm-d2001dac3f99d998b68d24bb2a9a4eb73f5161e7.zip llvm-d2001dac3f99d998b68d24bb2a9a4eb73f5161e7.tar.gz llvm-d2001dac3f99d998b68d24bb2a9a4eb73f5161e7.tar.bz2 |
Fix DoNotOptimize on MSVC
llvm-svn: 297532
-rw-r--r-- | libcxx/test/support/test_macros.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libcxx/test/support/test_macros.h b/libcxx/test/support/test_macros.h index cec5f5a..75b7885 100644 --- a/libcxx/test/support/test_macros.h +++ b/libcxx/test/support/test_macros.h @@ -188,9 +188,11 @@ inline void DoNotOptimize(Tp const& value) { asm volatile("" : : "g"(value) : "memory"); } #else +#include <intrin.h> template <class Tp> -inline void DoNotOptimize(Tp const&) { - // FIXME: Do something here... +inline void DoNotOptimize(Tp const& value) { + const volatile void* volatile = __builtin_addressof(value); + _ReadWriteBarrier(); } #endif |