File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
llvm/lib/Transforms/Instrumentation Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,10 @@ static cl::opt<bool> ClCompoundReadBeforeWrite(
80
80
" tsan-compound-read-before-write" , cl::init(false ),
81
81
cl::desc(" Emit special compound instrumentation for reads-before-writes" ),
82
82
cl::Hidden);
83
+ static cl::opt<bool > ClOmitNonCaptured (
84
+ " tsan-omit-by-pointer-capturing" , cl::init(true ),
85
+ cl::desc(" Omit accesses due to pointer capturing" ),
86
+ cl::Hidden);
83
87
84
88
STATISTIC (NumInstrumentedReads, " Number of instrumented reads" );
85
89
STATISTIC (NumInstrumentedWrites, " Number of instrumented writes" );
@@ -450,7 +454,7 @@ void ThreadSanitizer::chooseInstructionsToInstrument(
450
454
451
455
const AllocaInst *AI = findAllocaForValue (Addr);
452
456
// Instead of Addr, we should check whether its base pointer is captured.
453
- if (AI && !PointerMayBeCaptured (AI, /* ReturnCaptures=*/ true )) {
457
+ if (AI && !PointerMayBeCaptured (AI, /* ReturnCaptures=*/ true ) && ClOmitNonCaptured ) {
454
458
// The variable is addressable but not captured, so it cannot be
455
459
// referenced from a different thread and participate in a data race
456
460
// (see llvm/Analysis/CaptureTracking.h for details).
You can’t perform that action at this time.
0 commit comments