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 | 76880f55bf22de77f45db5fc9ebe66c63c7e0a16 (patch) | |
tree | f9d0a35c85118acc73dc95d1bc9368388d350317 | |
parent | 3b7c1348ca31918186362fa75cd14c33ec2e72f4 (diff) | |
download | external_libcxx-76880f55bf22de77f45db5fc9ebe66c63c7e0a16.tar.gz external_libcxx-76880f55bf22de77f45db5fc9ebe66c63c7e0a16.tar.bz2 external_libcxx-76880f55bf22de77f45db5fc9ebe66c63c7e0a16.zip |
Fix DoNotOptimize on MSVC
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@297532 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | test/support/test_macros.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/support/test_macros.h b/test/support/test_macros.h index cec5f5a5e..75b7885f8 100644 --- a/test/support/test_macros.h +++ b/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 |