diff options
author | Vitaly Buka <vitalybuka@google.com> | 2024-04-23 11:19:59 -0700 |
---|---|---|
committer | Vitaly Buka <vitalybuka@google.com> | 2024-04-23 11:20:50 -0700 |
commit | 1d140348733d5454c2dc72b3f4f16404981f2102 (patch) | |
tree | a62f59dfb1f1672485ebf9868a265bc190a4f161 | |
parent | 06cc1754f829d6b94dc797ed0f653d0eb52ef1ac (diff) |
[NFC][msan] Add DebugInstrumentInstruction DEBUG_COUNTER
-rw-r--r-- | llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp index 24c18cef2b0f..824cbee4eca5 100644 --- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -212,6 +212,9 @@ using namespace llvm; DEBUG_COUNTER(DebugInsertCheck, "msan-insert-check", "Controls which checks to insert"); +DEBUG_COUNTER(DebugInstrumentInstruction, "msan-instrument-instruction", + "Controls which instruction to instrument"); + static const unsigned kOriginSize = 4; static const Align kMinOriginAlignment = Align(4); static const Align kShadowTLSAlignment = Align(8); @@ -2176,6 +2179,13 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> { // Don't want to visit if we're in the prologue if (isInPrologue(I)) return; + if (!DebugCounter::shouldExecute(DebugInstrumentInstruction)) { + LLVM_DEBUG(dbgs() << "Skipping instruction: " << I << "\n"); + // We still need to set the shadow and origin to clean values. + setShadow(&I, getCleanShadow(&I)); + setOrigin(&I, getCleanOrigin()); + return; + } InstVisitor<MemorySanitizerVisitor>::visit(I); } |