forked from OSchip/llvm-project
[NewPM] Use a separate struct for ModuleThreadSanitizerPass
Split ThreadSanitizerPass into ThreadSanitizerPass (as a function pass) and ModuleThreadSanitizerPass (as a module pass). Main reason is to make sure that we have a unique mapping from ClassName to PassName in the new passmanager framework, making it possible to correctly identify the passes when dealing with options such as -print-after and -print-pipeline-passes. This is a follow-up to D105006 and D105007.
This commit is contained in:
parent
ab41eef9ac
commit
8f8616655c
|
@ -1142,7 +1142,7 @@ static void addSanitizers(const Triple &TargetTriple,
|
|||
MSanPass(SanitizerKind::KernelMemory, true);
|
||||
|
||||
if (LangOpts.Sanitize.has(SanitizerKind::Thread)) {
|
||||
MPM.addPass(ThreadSanitizerPass());
|
||||
MPM.addPass(ModuleThreadSanitizerPass());
|
||||
MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass()));
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,14 @@ FunctionPass *createThreadSanitizerLegacyPassPass();
|
|||
/// yet, the pass inserts the declarations. Otherwise the existing globals are
|
||||
struct ThreadSanitizerPass : public PassInfoMixin<ThreadSanitizerPass> {
|
||||
PreservedAnalyses run(Function &F, FunctionAnalysisManager &FAM);
|
||||
static bool isRequired() { return true; }
|
||||
};
|
||||
|
||||
/// A module pass for tsan instrumentation.
|
||||
///
|
||||
/// Create ctor and init functions.
|
||||
struct ModuleThreadSanitizerPass
|
||||
: public PassInfoMixin<ModuleThreadSanitizerPass> {
|
||||
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
|
||||
static bool isRequired() { return true; }
|
||||
};
|
||||
|
|
|
@ -111,7 +111,7 @@ MODULE_PASS("wholeprogramdevirt", WholeProgramDevirtPass())
|
|||
MODULE_PASS("dfsan", DataFlowSanitizerPass())
|
||||
MODULE_PASS("asan-module", ModuleAddressSanitizerPass(/*CompileKernel=*/false, false, true, false))
|
||||
MODULE_PASS("msan-module", ModuleMemorySanitizerPass({}))
|
||||
MODULE_PASS("tsan-module", ThreadSanitizerPass())
|
||||
MODULE_PASS("tsan-module", ModuleThreadSanitizerPass())
|
||||
MODULE_PASS("kasan-module", ModuleAddressSanitizerPass(/*CompileKernel=*/true, false, true, false))
|
||||
MODULE_PASS("sancov-module", ModuleSanitizerCoveragePass())
|
||||
MODULE_PASS("memprof-module", ModuleMemProfilerPass())
|
||||
|
|
|
@ -206,8 +206,8 @@ PreservedAnalyses ThreadSanitizerPass::run(Function &F,
|
|||
return PreservedAnalyses::all();
|
||||
}
|
||||
|
||||
PreservedAnalyses ThreadSanitizerPass::run(Module &M,
|
||||
ModuleAnalysisManager &MAM) {
|
||||
PreservedAnalyses ModuleThreadSanitizerPass::run(Module &M,
|
||||
ModuleAnalysisManager &MAM) {
|
||||
insertModuleCtor(M);
|
||||
return PreservedAnalyses::none();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue