mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-27 19:16:04 +00:00

Like r367463, but for tsan/{benchmarks,dd,go}. The files benchmarks aren't referenced in the build anywhere and where added in 2012 with the comment "no Makefiles yet". llvm-svn: 367567
21 lines
397 B
C++
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);
|
|
}
|