Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 63485bd

Browse files
committed
Merging r276015:
------------------------------------------------------------------------ r276015 | vedantk | 2016-07-19 13:16:08 -0700 (Tue, 19 Jul 2016) | 7 lines [tsan] Don't instrument __llvm_gcov_global_state_pred or __llvm_gcda* r274801 did not go far enough to allow gcov+tsan to cooperate. With this commit it's possible to run the following code without false positives: std::thread T1(fib), T2(fib); T1.join(); T2.join(); ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_39@276810 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent ae2034a commit 63485bd

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

lib/Transforms/Instrumentation/ThreadSanitizer.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,9 @@ static bool shouldInstrumentReadWriteFromAddress(Value *Addr) {
272272
return false;
273273
}
274274

275-
// Check if the global is in a GCOV counter array.
276-
if (GV->getName().startswith("__llvm_gcov_ctr"))
275+
// Check if the global is private gcov data.
276+
if (GV->getName().startswith("__llvm_gcov") ||
277+
GV->getName().startswith("__llvm_gcda"))
277278
return false;
278279
}
279280

test/Instrumentation/ThreadSanitizer/do-not-instrument-memory-access.ll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ target triple = "x86_64-apple-macosx10.9"
1313

1414
@__llvm_gcov_ctr = internal global [1 x i64] zeroinitializer
1515
@__llvm_gcov_ctr.1 = internal global [1 x i64] zeroinitializer
16+
@__llvm_gcov_global_state_pred = internal global i32 0
17+
@__llvm_gcda_foo = internal global i32 0
1618

1719
define i32 @test_gep() sanitize_thread {
1820
entry:
@@ -42,5 +44,16 @@ entry:
4244
ret i32 undef
4345
}
4446

47+
define void @test_load() sanitize_thread {
48+
entry:
49+
%0 = load i32, i32* @__llvm_gcov_global_state_pred
50+
store i32 1, i32* @__llvm_gcov_global_state_pred
51+
52+
%1 = load i32, i32* @__llvm_gcda_foo
53+
store i32 1, i32* @__llvm_gcda_foo
54+
55+
ret void
56+
}
57+
4558
; CHECK-NOT: {{call void @__tsan_write}}
4659
; CHECK: __tsan_init

0 commit comments

Comments
 (0)