diff options
| author | Vedant Kumar <vsk@apple.com> | 2016-07-07 22:45:28 +0000 |
|---|---|---|
| committer | Vedant Kumar <vsk@apple.com> | 2016-07-07 22:45:28 +0000 |
| commit | 0fdffd37095b5c5c405518d3fa651315a29a7dc5 (patch) | |
| tree | 2d479b346844783e5bb3262ea70802387a11511f /llvm | |
| parent | 3339c568c43e4644f02289e5edfc78c860f19c9f (diff) | |
| download | bcm5719-llvm-0fdffd37095b5c5c405518d3fa651315a29a7dc5.tar.gz bcm5719-llvm-0fdffd37095b5c5c405518d3fa651315a29a7dc5.zip | |
[tsan] Try harder to not instrument gcov counters
GCOVProfiler::emitProfileArcs() can create many variables with names
starting with "__llvm_gcov_ctr", so llvm appends a numeric suffix to
most of them. Teach tsan about this.
llvm-svn: 274801
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp | 4 | ||||
| -rw-r--r-- | llvm/test/Instrumentation/ThreadSanitizer/do-not-instrument-memory-access.ll | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp index a23b1ddf825..dcb62d3ed1b 100644 --- a/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/ThreadSanitizer.cpp @@ -272,8 +272,8 @@ static bool shouldInstrumentReadWriteFromAddress(Value *Addr) { return false; } - // Check if the global is in the GCOV counters array. - if (GV->getName() == "__llvm_gcov_ctr") + // Check if the global is in a GCOV counter array. + if (GV->getName().startswith("__llvm_gcov_ctr")) return false; } diff --git a/llvm/test/Instrumentation/ThreadSanitizer/do-not-instrument-memory-access.ll b/llvm/test/Instrumentation/ThreadSanitizer/do-not-instrument-memory-access.ll index e734a382a9c..db12ec7daec 100644 --- a/llvm/test/Instrumentation/ThreadSanitizer/do-not-instrument-memory-access.ll +++ b/llvm/test/Instrumentation/ThreadSanitizer/do-not-instrument-memory-access.ll @@ -12,6 +12,7 @@ target triple = "x86_64-apple-macosx10.9" @__profc_test_bitcast_foo = private global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8 @__llvm_gcov_ctr = internal global [1 x i64] zeroinitializer +@__llvm_gcov_ctr.1 = internal global [1 x i64] zeroinitializer define i32 @test_gep() sanitize_thread { entry: @@ -23,6 +24,10 @@ entry: %1 = add i64 %gcovcount, 1 store i64 %1, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_gcov_ctr, i64 0, i64 0) + %gcovcount.1 = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_gcov_ctr.1, i64 0, i64 0) + %2 = add i64 %gcovcount.1, 1 + store i64 %2, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_gcov_ctr.1, i64 0, i64 0) + ret i32 1 } |

