[llvm] f0c2ffa - [msan] Add msan-insert-check DEBUG_COUNTER
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 15 21:53:10 PDT 2022
Author: Vitaly Buka
Date: 2022-09-15T21:52:58-07:00
New Revision: f0c2ffa8f820fabb8b16f5ef81b7b2913eb19b36
URL: https://github.com/llvm/llvm-project/commit/f0c2ffa8f820fabb8b16f5ef81b7b2913eb19b36
DIFF: https://github.com/llvm/llvm-project/commit/f0c2ffa8f820fabb8b16f5ef81b7b2913eb19b36.diff
LOG: [msan] Add msan-insert-check DEBUG_COUNTER
Added:
Modified:
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index a14a5cb944b0..d22f81c2f082 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -186,6 +186,7 @@
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
+#include "llvm/Support/DebugCounter.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
@@ -204,6 +205,9 @@ using namespace llvm;
#define DEBUG_TYPE "msan"
+DEBUG_COUNTER(DebugInsertCheck, "msan-insert-check",
+ "Controls which checks to insert");
+
static const unsigned kOriginSize = 4;
static const Align kMinOriginAlignment = Align(4);
static const Align kShadowTLSAlignment = Align(8);
@@ -1999,6 +2003,12 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
assert(Shadow);
if (!InsertChecks)
return;
+
+ if (!DebugCounter::shouldExecute(DebugInsertCheck)) {
+ LLVM_DEBUG(dbgs() << "Skipping check of " << *Shadow << " before "
+ << *OrigIns << "\n");
+ return;
+ }
#ifndef NDEBUG
Type *ShadowTy = Shadow->getType();
assert((isa<IntegerType>(ShadowTy) || isa<VectorType>(ShadowTy) ||
More information about the llvm-commits
mailing list