diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:52:22 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:52:22 +0000 |
| commit | 3a1720af1d7f43edc5b214cde0be11bfb94d077e (patch) | |
| tree | 029e0ff2d5e3c0eaf2405fd8e669555fdf5e1297 /lib/tsan/benchmarks/func_entry_exit.cpp | |
| parent | 8f3cadc28cb2bb9e8f9d69eeaaea1f57f2f7b2ab (diff) | |
Vendor import of stripped compiler-rt trunk r375505, the last commitvendor/compiler-rt/compiler-rt-trunk-r375505vendor/compiler-rt
before the upstream Subversion repository was made read-only, and the
LLVM project migrated to GitHub:
https://llvm.org/svn/llvm-project/compiler-rt/trunk@375505
Notes
Notes:
svn path=/vendor/compiler-rt/dist/; revision=353944
svn path=/vendor/compiler-rt/compiler-rt-r375505/; revision=353945; tag=vendor/compiler-rt/compiler-rt-trunk-r375505
Diffstat (limited to 'lib/tsan/benchmarks/func_entry_exit.cpp')
| -rw-r--r-- | lib/tsan/benchmarks/func_entry_exit.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/tsan/benchmarks/func_entry_exit.cpp b/lib/tsan/benchmarks/func_entry_exit.cpp new file mode 100644 index 000000000000..5e0ba1d6981b --- /dev/null +++ b/lib/tsan/benchmarks/func_entry_exit.cpp @@ -0,0 +1,20 @@ +// 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); +} |
