diff --git a/llvm/bindings/go/llvm/InstrumentationBindings.h b/llvm/bindings/go/llvm/InstrumentationBindings.h --- a/llvm/bindings/go/llvm/InstrumentationBindings.h +++ b/llvm/bindings/go/llvm/InstrumentationBindings.h @@ -26,7 +26,6 @@ void LLVMAddAddressSanitizerFunctionPass(LLVMPassManagerRef PM); void LLVMAddAddressSanitizerModulePass(LLVMPassManagerRef PM); void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM); -void LLVMAddMemorySanitizerLegacyPassPass(LLVMPassManagerRef PM); void LLVMAddDataFlowSanitizerPass(LLVMPassManagerRef PM, int ABIListFilesNum, const char **ABIListFiles); diff --git a/llvm/bindings/go/llvm/InstrumentationBindings.cpp b/llvm/bindings/go/llvm/InstrumentationBindings.cpp --- a/llvm/bindings/go/llvm/InstrumentationBindings.cpp +++ b/llvm/bindings/go/llvm/InstrumentationBindings.cpp @@ -34,10 +34,6 @@ unwrap(PM)->add(createThreadSanitizerLegacyPassPass()); } -void LLVMAddMemorySanitizerLegacyPassPass(LLVMPassManagerRef PM) { - unwrap(PM)->add(createMemorySanitizerLegacyPassPass()); -} - void LLVMAddDataFlowSanitizerPass(LLVMPassManagerRef PM, int ABIListFilesNum, const char **ABIListFiles) { diff --git a/llvm/bindings/go/llvm/transforms_instrumentation.go b/llvm/bindings/go/llvm/transforms_instrumentation.go --- a/llvm/bindings/go/llvm/transforms_instrumentation.go +++ b/llvm/bindings/go/llvm/transforms_instrumentation.go @@ -31,10 +31,6 @@ C.LLVMAddThreadSanitizerPass(pm.C) } -func (pm PassManager) AddMemorySanitizerLegacyPassPass() { - C.LLVMAddMemorySanitizerLegacyPassPass(pm.C) -} - func (pm PassManager) AddDataFlowSanitizerPass(abilist []string) { abiliststrs := make([]*C.char, len(abilist)) for i, arg := range abilist { diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h --- a/llvm/include/llvm/InitializePasses.h +++ b/llvm/include/llvm/InitializePasses.h @@ -316,7 +316,6 @@ void initializeMemoryDependenceWrapperPassPass(PassRegistry&); void initializeMemorySSAPrinterLegacyPassPass(PassRegistry&); void initializeMemorySSAWrapperPassPass(PassRegistry&); -void initializeMemorySanitizerLegacyPassPass(PassRegistry&); void initializeMergeFunctionsLegacyPassPass(PassRegistry&); void initializeMergeICmpsLegacyPassPass(PassRegistry &); void initializeMergedLoadStoreMotionLegacyPassPass(PassRegistry&); diff --git a/llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h b/llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h --- a/llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h +++ b/llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h @@ -35,10 +35,6 @@ bool EagerChecks; }; -// Insert MemorySanitizer instrumentation (detection of uninitialized reads) -FunctionPass * -createMemorySanitizerLegacyPassPass(MemorySanitizerOptions Options = {}); - /// A function pass for msan instrumentation. /// /// Instruments functions to detect unitialized reads. This function pass diff --git a/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp b/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp --- a/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp @@ -101,7 +101,6 @@ initializeCGProfileLegacyPassPass(Registry); initializeInstrOrderFileLegacyPassPass(Registry); initializeInstrProfilingLegacyPassPass(Registry); - initializeMemorySanitizerLegacyPassPass(Registry); initializeHWAddressSanitizerLegacyPassPass(Registry); initializeThreadSanitizerLegacyPassPass(Registry); initializeModuleSanitizerCoverageLegacyPassPass(Registry); diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp --- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp @@ -631,33 +631,6 @@ }); } -/// A legacy function pass for msan instrumentation. -/// -/// Instruments functions to detect uninitialized reads. -struct MemorySanitizerLegacyPass : public FunctionPass { - // Pass identification, replacement for typeid. - static char ID; - - MemorySanitizerLegacyPass(MemorySanitizerOptions Options = {}) - : FunctionPass(ID), Options(Options) { - initializeMemorySanitizerLegacyPassPass(*PassRegistry::getPassRegistry()); - } - StringRef getPassName() const override { return "MemorySanitizerLegacyPass"; } - - void getAnalysisUsage(AnalysisUsage &AU) const override { - AU.addRequired(); - } - - bool runOnFunction(Function &F) override { - return MSan->sanitizeFunction( - F, getAnalysis().getTLI(F)); - } - bool doInitialization(Module &M) override; - - Optional MSan; - MemorySanitizerOptions Options; -}; - template T getOptOrDefault(const cl::opt &Opt, T Default) { return (Opt.getNumOccurrences() > 0) ? Opt : Default; } @@ -702,21 +675,6 @@ OS << ">"; } -char MemorySanitizerLegacyPass::ID = 0; - -INITIALIZE_PASS_BEGIN(MemorySanitizerLegacyPass, "msan", - "MemorySanitizer: detects uninitialized reads.", false, - false) -INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass) -INITIALIZE_PASS_END(MemorySanitizerLegacyPass, "msan", - "MemorySanitizer: detects uninitialized reads.", false, - false) - -FunctionPass * -llvm::createMemorySanitizerLegacyPassPass(MemorySanitizerOptions Options) { - return new MemorySanitizerLegacyPass(Options); -} - /// Create a non-const global initialized with the given string. /// /// Creates a writable global for Str so that we can pass it to the @@ -1014,13 +972,6 @@ } } -bool MemorySanitizerLegacyPass::doInitialization(Module &M) { - if (!Options.Kernel) - insertModuleCtor(M); - MSan.emplace(M, Options); - return true; -} - namespace { /// A helper class that handles instrumentation of VarArg