[llvm] d133538 - [LegacyPM] Remove MemorySanitizerLegacyPass
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 21 10:21:52 PDT 2022
Author: Fangrui Song
Date: 2022-04-21T10:21:46-07:00
New Revision: d133538b8b8475586079e932ed1ad4dd63f53ba5
URL: https://github.com/llvm/llvm-project/commit/d133538b8b8475586079e932ed1ad4dd63f53ba5
DIFF: https://github.com/llvm/llvm-project/commit/d133538b8b8475586079e932ed1ad4dd63f53ba5.diff
LOG: [LegacyPM] Remove MemorySanitizerLegacyPass
Using the legacy PM for the optimization pipeline was deprecated in 13.0.0.
Following recent changes to remove non-core features of the legacy
PM/optimization pipeline, remove MemorySanitizerLegacyPass.
Differential Revision: https://reviews.llvm.org/D123894
Added:
Modified:
llvm/bindings/go/llvm/InstrumentationBindings.cpp
llvm/bindings/go/llvm/InstrumentationBindings.h
llvm/bindings/go/llvm/transforms_instrumentation.go
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
Removed:
################################################################################
diff --git a/llvm/bindings/go/llvm/InstrumentationBindings.cpp b/llvm/bindings/go/llvm/InstrumentationBindings.cpp
index b9b73e98b22b9..30eb4e3a7b4c4 100644
--- a/llvm/bindings/go/llvm/InstrumentationBindings.cpp
+++ b/llvm/bindings/go/llvm/InstrumentationBindings.cpp
@@ -34,10 +34,6 @@ void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM) {
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/InstrumentationBindings.h b/llvm/bindings/go/llvm/InstrumentationBindings.h
index 143086c062743..edb5f79e0011b 100644
--- a/llvm/bindings/go/llvm/InstrumentationBindings.h
+++ b/llvm/bindings/go/llvm/InstrumentationBindings.h
@@ -26,7 +26,6 @@ extern "C" {
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/transforms_instrumentation.go b/llvm/bindings/go/llvm/transforms_instrumentation.go
index 68e0ed6967979..f8b5991341d6e 100644
--- a/llvm/bindings/go/llvm/transforms_instrumentation.go
+++ b/llvm/bindings/go/llvm/transforms_instrumentation.go
@@ -31,10 +31,6 @@ func (pm PassManager) AddThreadSanitizerPass() {
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
index e5d6b8304c4ab..84a6639daa5a4 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -316,7 +316,6 @@ void initializeMemDerefPrinterPass(PassRegistry&);
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
index 3374c2ce1155e..e4654a0fc7ef9 100644
--- a/llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
+++ b/llvm/include/llvm/Transforms/Instrumentation/MemorySanitizer.h
@@ -35,10 +35,6 @@ struct MemorySanitizerOptions {
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
index 7a825bcb09e69..7347e746d2c25 100644
--- a/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
+++ b/llvm/lib/Transforms/Instrumentation/Instrumentation.cpp
@@ -101,7 +101,6 @@ void llvm::initializeInstrumentation(PassRegistry &Registry) {
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
index 9da01b834301a..ab3acde64bcab 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -631,33 +631,6 @@ void insertModuleCtor(Module &M) {
});
}
-/// 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<TargetLibraryInfoWrapperPass>();
- }
-
- bool runOnFunction(Function &F) override {
- return MSan->sanitizeFunction(
- F, getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F));
- }
- bool doInitialization(Module &M) override;
-
- Optional<MemorySanitizer> MSan;
- MemorySanitizerOptions Options;
-};
-
template <class T> T getOptOrDefault(const cl::opt<T> &Opt, T Default) {
return (Opt.getNumOccurrences() > 0) ? Opt : Default;
}
@@ -702,21 +675,6 @@ void MemorySanitizerPass::printPipeline(
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 @@ void MemorySanitizer::initializeModule(Module &M) {
}
}
-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
More information about the llvm-commits
mailing list