llvm.org GIT mirror llvm / a161bdd
[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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274801 91177308-0d34-0410-b5e6-96231b3b80d8 Vedant Kumar 4 years ago
2 changed file(s) with 7 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
271271 return false;
272272 }
273273
274 // Check if the global is in the GCOV counters array.
275 if (GV->getName() == "__llvm_gcov_ctr")
274 // Check if the global is in a GCOV counter array.
275 if (GV->getName().startswith("__llvm_gcov_ctr"))
276276 return false;
277277 }
278278
1111 @__profc_test_bitcast_foo = private global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
1212
1313 @__llvm_gcov_ctr = internal global [1 x i64] zeroinitializer
14 @__llvm_gcov_ctr.1 = internal global [1 x i64] zeroinitializer
1415
1516 define i32 @test_gep() sanitize_thread {
1617 entry:
2122 %gcovcount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_gcov_ctr, i64 0, i64 0)
2223 %1 = add i64 %gcovcount, 1
2324 store i64 %1, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_gcov_ctr, i64 0, i64 0)
25
26 %gcovcount.1 = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_gcov_ctr.1, i64 0, i64 0)
27 %2 = add i64 %gcovcount.1, 1
28 store i64 %2, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_gcov_ctr.1, i64 0, i64 0)
2429
2530 ret i32 1
2631 }