2020-09-30 01:38:51 +08:00
|
|
|
/// -fprofile-update=atomic (implied by -fsanitize=thread) requires the
|
|
|
|
/// (potentially concurrent) counter updates to be atomic.
|
2020-10-20 13:17:32 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple x86_64 -emit-llvm -fprofile-update=atomic -ftest-coverage -fprofile-arcs \
|
2020-08-29 07:32:35 +08:00
|
|
|
// RUN: -coverage-notes-file /dev/null -coverage-data-file /dev/null -o - | FileCheck %s
|
|
|
|
|
|
|
|
// CHECK-LABEL: void @foo()
|
|
|
|
/// Two counters are incremented by __tsan_atomic64_fetch_add.
|
2021-02-12 06:33:43 +08:00
|
|
|
// CHECK: atomicrmw add i64* {{.*}} @__llvm_gcov_ctr{{.*}} monotonic, align 8
|
2020-09-30 01:38:51 +08:00
|
|
|
// CHECK-NEXT: atomicrmw sub i32*
|
2020-08-29 07:32:35 +08:00
|
|
|
|
|
|
|
_Atomic(int) cnt;
|
|
|
|
void foo() { cnt--; }
|