[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
This commit is contained in:
Fangrui Song 2022-04-21 10:21:46 -07:00
parent 889588ee97
commit d133538b8b
7 changed files with 0 additions and 64 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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 {

View File

@ -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&);

View File

@ -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

View File

@ -101,7 +101,6 @@ void llvm::initializeInstrumentation(PassRegistry &Registry) {
initializeCGProfileLegacyPassPass(Registry);
initializeInstrOrderFileLegacyPassPass(Registry);
initializeInstrProfilingLegacyPassPass(Registry);
initializeMemorySanitizerLegacyPassPass(Registry);
initializeHWAddressSanitizerLegacyPassPass(Registry);
initializeThreadSanitizerLegacyPassPass(Registry);
initializeModuleSanitizerCoverageLegacyPassPass(Registry);

View File

@ -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