[XRay][ARM32][AArch64] Fix unstable FDR tests on weak-ordering CPUs

Summary: Change from `compare_exchange_weak()` to `compare_exchange_strong()` where appropriate, because on ARM ( http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/3190 , http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-full/builds/3191 ) and AArch64 ( http://lab.llvm.org:8011/builders/clang-cmake-aarch64-42vma/builds/3900 ) it fails even in single-threaded scenarios.

Reviewers: dberris, rengolin

Reviewed By: rengolin

Subscribers: aemerson, llvm-commits, iid_iunknown

Differential Revision: https://reviews.llvm.org/D29286

llvm-svn: 293505
This commit is contained in:
Serge Rogatch 2017-01-30 17:10:49 +00:00
parent 41c1499504
commit 7ccb24f8cb
1 changed files with 4 additions and 4 deletions

View File

@ -59,7 +59,7 @@ XRayLogInitStatus FDRLogging_init(std::size_t BufferSize, std::size_t BufferMax,
size_t OptionsSize) XRAY_NEVER_INSTRUMENT {
assert(OptionsSize == sizeof(FDRLoggingOptions));
XRayLogInitStatus CurrentStatus = XRayLogInitStatus::XRAY_LOG_UNINITIALIZED;
if (!LoggingStatus.compare_exchange_weak(
if (!LoggingStatus.compare_exchange_strong(
CurrentStatus, XRayLogInitStatus::XRAY_LOG_INITIALIZING,
std::memory_order_release, std::memory_order_relaxed))
return CurrentStatus;
@ -91,7 +91,7 @@ XRayLogFlushStatus FDRLogging_flush() XRAY_NEVER_INSTRUMENT {
return XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING;
XRayLogFlushStatus Result = XRayLogFlushStatus::XRAY_LOG_NOT_FLUSHING;
if (!LogFlushStatus.compare_exchange_weak(
if (!LogFlushStatus.compare_exchange_strong(
Result, XRayLogFlushStatus::XRAY_LOG_FLUSHING,
std::memory_order_release, std::memory_order_relaxed))
return Result;
@ -143,7 +143,7 @@ XRayLogFlushStatus FDRLogging_flush() XRAY_NEVER_INSTRUMENT {
XRayLogInitStatus FDRLogging_finalize() XRAY_NEVER_INSTRUMENT {
XRayLogInitStatus CurrentStatus = XRayLogInitStatus::XRAY_LOG_INITIALIZED;
if (!LoggingStatus.compare_exchange_weak(
if (!LoggingStatus.compare_exchange_strong(
CurrentStatus, XRayLogInitStatus::XRAY_LOG_FINALIZING,
std::memory_order_release, std::memory_order_relaxed))
return CurrentStatus;
@ -159,7 +159,7 @@ XRayLogInitStatus FDRLogging_finalize() XRAY_NEVER_INSTRUMENT {
XRayLogInitStatus FDRLogging_reset() XRAY_NEVER_INSTRUMENT {
XRayLogInitStatus CurrentStatus = XRayLogInitStatus::XRAY_LOG_FINALIZED;
if (!LoggingStatus.compare_exchange_weak(
if (!LoggingStatus.compare_exchange_strong(
CurrentStatus, XRayLogInitStatus::XRAY_LOG_UNINITIALIZED,
std::memory_order_release, std::memory_order_relaxed))
return CurrentStatus;