[LegacyPM] Remove ThreadSanitizerLegacyPass
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 ThreadSanitizerLegacyPass. Reviewed By: #sanitizers, vitalybuka Differential Revision: https://reviews.llvm.org/D124209
This commit is contained in:
parent
761366e6ae
commit
c74a706893
|
@ -16,15 +16,9 @@
|
|||
#include "llvm/IR/Module.h"
|
||||
#include "llvm/Pass.h"
|
||||
#include "llvm/Transforms/Instrumentation.h"
|
||||
#include "llvm/Transforms/Instrumentation/MemorySanitizer.h"
|
||||
#include "llvm/Transforms/Instrumentation/ThreadSanitizer.h"
|
||||
|
||||
using namespace llvm;
|
||||
|
||||
void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM) {
|
||||
unwrap(PM)->add(createThreadSanitizerLegacyPassPass());
|
||||
}
|
||||
|
||||
void LLVMAddDataFlowSanitizerPass(LLVMPassManagerRef PM,
|
||||
int ABIListFilesNum,
|
||||
const char **ABIListFiles) {
|
||||
|
|
|
@ -23,7 +23,6 @@ extern "C" {
|
|||
// a (somewhat) less stable collection of C APIs for use in creating bindings of
|
||||
// LLVM in other languages.
|
||||
|
||||
void LLVMAddThreadSanitizerPass(LLVMPassManagerRef PM);
|
||||
void LLVMAddDataFlowSanitizerPass(LLVMPassManagerRef PM, int ABIListFilesNum,
|
||||
const char **ABIListFiles);
|
||||
|
||||
|
|
|
@ -19,10 +19,6 @@ package llvm
|
|||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
func (pm PassManager) AddThreadSanitizerPass() {
|
||||
C.LLVMAddThreadSanitizerPass(pm.C)
|
||||
}
|
||||
|
||||
func (pm PassManager) AddDataFlowSanitizerPass(abilist []string) {
|
||||
abiliststrs := make([]*C.char, len(abilist))
|
||||
for i, arg := range abilist {
|
||||
|
|
|
@ -432,7 +432,6 @@ void initializeTailDuplicatePass(PassRegistry&);
|
|||
void initializeTargetLibraryInfoWrapperPassPass(PassRegistry&);
|
||||
void initializeTargetPassConfigPass(PassRegistry&);
|
||||
void initializeTargetTransformInfoWrapperPassPass(PassRegistry&);
|
||||
void initializeThreadSanitizerLegacyPassPass(PassRegistry&);
|
||||
void initializeTLSVariableHoistLegacyPassPass(PassRegistry &);
|
||||
void initializeTwoAddressInstructionPassPass(PassRegistry&);
|
||||
void initializeTypeBasedAAWrapperPassPass(PassRegistry&);
|
||||
|
|
|
@ -19,8 +19,6 @@ namespace llvm {
|
|||
class Function;
|
||||
class FunctionPass;
|
||||
class Module;
|
||||
// Insert ThreadSanitizer (race detection) instrumentation
|
||||
FunctionPass *createThreadSanitizerLegacyPassPass();
|
||||
|
||||
/// A function pass for tsan instrumentation.
|
||||
///
|
||||
|
|
|
@ -98,7 +98,6 @@ void llvm::initializeInstrumentation(PassRegistry &Registry) {
|
|||
initializeCGProfileLegacyPassPass(Registry);
|
||||
initializeInstrOrderFileLegacyPassPass(Registry);
|
||||
initializeInstrProfilingLegacyPassPass(Registry);
|
||||
initializeThreadSanitizerLegacyPassPass(Registry);
|
||||
initializeModuleSanitizerCoverageLegacyPassPass(Registry);
|
||||
initializeDataFlowSanitizerLegacyPassPass(Registry);
|
||||
}
|
||||
|
|
|
@ -173,19 +173,6 @@ private:
|
|||
FunctionCallee MemmoveFn, MemcpyFn, MemsetFn;
|
||||
};
|
||||
|
||||
struct ThreadSanitizerLegacyPass : FunctionPass {
|
||||
ThreadSanitizerLegacyPass() : FunctionPass(ID) {
|
||||
initializeThreadSanitizerLegacyPassPass(*PassRegistry::getPassRegistry());
|
||||
}
|
||||
StringRef getPassName() const override;
|
||||
void getAnalysisUsage(AnalysisUsage &AU) const override;
|
||||
bool runOnFunction(Function &F) override;
|
||||
bool doInitialization(Module &M) override;
|
||||
static char ID; // Pass identification, replacement for typeid.
|
||||
private:
|
||||
Optional<ThreadSanitizer> TSan;
|
||||
};
|
||||
|
||||
void insertModuleCtor(Module &M) {
|
||||
getOrCreateSanitizerCtorAndInitFunctions(
|
||||
M, kTsanModuleCtorName, kTsanInitName, /*InitArgTypes=*/{},
|
||||
|
@ -210,38 +197,6 @@ PreservedAnalyses ModuleThreadSanitizerPass::run(Module &M,
|
|||
insertModuleCtor(M);
|
||||
return PreservedAnalyses::none();
|
||||
}
|
||||
|
||||
char ThreadSanitizerLegacyPass::ID = 0;
|
||||
INITIALIZE_PASS_BEGIN(ThreadSanitizerLegacyPass, "tsan",
|
||||
"ThreadSanitizer: detects data races.", false, false)
|
||||
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
|
||||
INITIALIZE_PASS_END(ThreadSanitizerLegacyPass, "tsan",
|
||||
"ThreadSanitizer: detects data races.", false, false)
|
||||
|
||||
StringRef ThreadSanitizerLegacyPass::getPassName() const {
|
||||
return "ThreadSanitizerLegacyPass";
|
||||
}
|
||||
|
||||
void ThreadSanitizerLegacyPass::getAnalysisUsage(AnalysisUsage &AU) const {
|
||||
AU.addRequired<TargetLibraryInfoWrapperPass>();
|
||||
}
|
||||
|
||||
bool ThreadSanitizerLegacyPass::doInitialization(Module &M) {
|
||||
insertModuleCtor(M);
|
||||
TSan.emplace();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ThreadSanitizerLegacyPass::runOnFunction(Function &F) {
|
||||
auto &TLI = getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F);
|
||||
TSan->sanitizeFunction(F, TLI);
|
||||
return true;
|
||||
}
|
||||
|
||||
FunctionPass *llvm::createThreadSanitizerLegacyPassPass() {
|
||||
return new ThreadSanitizerLegacyPass();
|
||||
}
|
||||
|
||||
void ThreadSanitizer::initialize(Module &M) {
|
||||
const DataLayout &DL = M.getDataLayout();
|
||||
IntptrTy = DL.getIntPtrType(M.getContext());
|
||||
|
|
Loading…
Reference in New Issue