llvm.org GIT mirror llvm / bdba755
[tsan] Do not instrument accesses to the gcov counters array There is a known intended race here. This is a follow-up to r264805, which disabled tsan instrumentation for updates to instrprof counters. For more background on this please see the discussion in D18164. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@273202 91177308-0d34-0410-b5e6-96231b3b80d8 Vedant Kumar 4 years ago
2 changed file(s) with 12 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
270270 /*AddSegment=*/false)))
271271 return false;
272272 }
273
274 // Check if the global is in the GCOV counters array.
275 if (GV->getName() == "__llvm_gcov_ctr")
276 return false;
273277 }
274278 return true;
275279 }
0 ; This test checks that we are not instrumenting unwanted acesses to globals:
11 ; - Instruction profiler counter instrumentation has known intended races.
2 ; - The gcov counters array has a known intended race.
23 ;
34 ; RUN: opt < %s -tsan -S | FileCheck %s
45
910 @__profc_test_bitcast = private global [2 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
1011 @__profc_test_bitcast_foo = private global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
1112
13 @__llvm_gcov_ctr = internal global [1 x i64] zeroinitializer
14
1215 define i32 @test_gep() sanitize_thread {
1316 entry:
1417 %pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test_gep, i64 0, i64 0)
1518 %0 = add i64 %pgocount, 1
1619 store i64 %0, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test_gep, i64 0, i64 0)
20
21 %gcovcount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_gcov_ctr, i64 0, i64 0)
22 %1 = add i64 %gcovcount, 1
23 store i64 %1, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_gcov_ctr, i64 0, i64 0)
24
1725 ret i32 1
1826 }
1927