Files
clang-p2996/compiler-rt/lib/tsan/benchmarks/func_entry_exit.cc
Dmitry Vyukov bdfba86047 tsan: add more benchmarks
func_entry_exit.cc is for __tsan_func_entry/exit (spends ~75% there),
we don't yet have any.
mop.cc is for memory access functions, as compared to mini_bench_local/shared.cc
this benchmark passes through deduplication logic (ContainsSameAccess).

llvm-svn: 353407
2019-02-07 14:04:04 +00:00

21 lines
397 B
C++

// Synthetic benchmark for __tsan_func_entry/exit (spends ~75% there).
void foo(bool x);
int main() {
volatile int kRepeat1 = 1 << 30;
const int kRepeat = kRepeat1;
for (int i = 0; i < kRepeat; i++)
foo(false);
}
__attribute__((noinline)) void bar(volatile bool x) {
if (x)
foo(x);
}
__attribute__((noinline)) void foo(bool x) {
if (__builtin_expect(x, false))
bar(x);
}