Skip to content

Commit 1d14034

Browse files
committed
[NFC][msan] Add DebugInstrumentInstruction DEBUG_COUNTER
1 parent 06cc175 commit 1d14034

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ using namespace llvm;
212212
DEBUG_COUNTER(DebugInsertCheck, "msan-insert-check",
213213
"Controls which checks to insert");
214214

215+
DEBUG_COUNTER(DebugInstrumentInstruction, "msan-instrument-instruction",
216+
"Controls which instruction to instrument");
217+
215218
static const unsigned kOriginSize = 4;
216219
static const Align kMinOriginAlignment = Align(4);
217220
static const Align kShadowTLSAlignment = Align(8);
@@ -2176,6 +2179,13 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
21762179
// Don't want to visit if we're in the prologue
21772180
if (isInPrologue(I))
21782181
return;
2182+
if (!DebugCounter::shouldExecute(DebugInstrumentInstruction)) {
2183+
LLVM_DEBUG(dbgs() << "Skipping instruction: " << I << "\n");
2184+
// We still need to set the shadow and origin to clean values.
2185+
setShadow(&I, getCleanShadow(&I));
2186+
setOrigin(&I, getCleanOrigin());
2187+
return;
2188+
}
21792189
InstVisitor<MemorySanitizerVisitor>::visit(I);
21802190
}
21812191

0 commit comments

Comments
 (0)