aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-03-11 00:07:08 +0000
committerEric Fiselier <eric@efcs.ca>2017-03-11 00:07:08 +0000
commitd2001dac3f99d998b68d24bb2a9a4eb73f5161e7 (patch)
tree092c15d1a7189b06cc7cd7a52a5735358d1a1e63
parentc28c7e5bd3439c32cc70cc454bb51a8bfcdd559f (diff)
downloadllvm-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.h6
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