[llvm] r274801 - [tsan] Try harder to not instrument gcov counters
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 7 15:45:28 PDT 2016
Author: vedantk
Date: Thu Jul 7 17:45:28 2016
New Revision: 274801
URL: http://llvm.org/viewvc/llvm-project?rev=274801&view=rev
Log:
[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.
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=274801&r1=274800&r2=274801&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/ThreadSanitizer.cpp Thu Jul 7 17:45:28 2016
@@ -272,8 +272,8 @@ static bool shouldInstrumentReadWriteFro
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;
}
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=274801&r1=274800&r2=274801&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 Thu Jul 7 17:45:28 2016
@@ -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
+ at __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
}
More information about the llvm-commits
mailing list