[llvm] r273202 - [tsan] Do not instrument accesses to the gcov counters array
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 20 14:24:26 PDT 2016
Author: vedantk
Date: Mon Jun 20 16:24:26 2016
New Revision: 273202
URL: http://llvm.org/viewvc/llvm-project?rev=273202&view=rev
Log:
[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.
Modified:
llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
llvm/trunk/test/Instrumentation/ThreadSanitizer/do-not-instrument-memory-access.ll
Modified: llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp?rev=273202&r1=273201&r2=273202&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp Mon Jun 20 16:24:26 2016
@@ -271,6 +271,10 @@ static bool shouldInstrumentReadWriteFro
/*AddSegment=*/false)))
return false;
}
+
+ // Check if the global is in the GCOV counters array.
+ if (GV->getName() == "__llvm_gcov_ctr")
+ return false;
}
return true;
}
Modified: llvm/trunk/test/Instrumentation/ThreadSanitizer/do-not-instrument-memory-access.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/ThreadSanitizer/do-not-instrument-memory-access.ll?rev=273202&r1=273201&r2=273202&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/ThreadSanitizer/do-not-instrument-memory-access.ll (original)
+++ llvm/trunk/test/Instrumentation/ThreadSanitizer/do-not-instrument-memory-access.ll Mon Jun 20 16:24:26 2016
@@ -1,5 +1,6 @@
; This test checks that we are not instrumenting unwanted acesses to globals:
; - Instruction profiler counter instrumentation has known intended races.
+; - The gcov counters array has a known intended race.
;
; RUN: opt < %s -tsan -S | FileCheck %s
@@ -10,11 +11,18 @@ target triple = "x86_64-apple-macosx10.9
@__profc_test_bitcast = private global [2 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
@__profc_test_bitcast_foo = private global [1 x i64] zeroinitializer, section "__DATA,__llvm_prf_cnts", align 8
+ at __llvm_gcov_ctr = internal global [1 x i64] zeroinitializer
+
define i32 @test_gep() sanitize_thread {
entry:
%pgocount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test_gep, i64 0, i64 0)
%0 = add i64 %pgocount, 1
store i64 %0, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__profc_test_gep, i64 0, i64 0)
+
+ %gcovcount = load i64, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_gcov_ctr, i64 0, i64 0)
+ %1 = add i64 %gcovcount, 1
+ store i64 %1, i64* getelementptr inbounds ([1 x i64], [1 x i64]* @__llvm_gcov_ctr, i64 0, i64 0)
+
ret i32 1
}
More information about the llvm-commits
mailing list