PassWrapper: handle separate Module*SanitizerPass
Change ab41eef9aca3 in LLVM split MemorySanitizerPass into MemorySanitizerPass for functions and ModuleMemorySanitizerPass for modules. There's a related change for ThreadSanitizerPass, and in here since we're using a ModulePassManager I only add the module flavor of the pass on LLVM 14. r? @nikic cc @nagisa
This commit is contained in:
@@ -875,8 +875,12 @@ LLVMRustOptimizeWithNewPassManager(
|
|||||||
#if LLVM_VERSION_GE(11, 0)
|
#if LLVM_VERSION_GE(11, 0)
|
||||||
OptimizerLastEPCallbacks.push_back(
|
OptimizerLastEPCallbacks.push_back(
|
||||||
[Options](ModulePassManager &MPM, OptimizationLevel Level) {
|
[Options](ModulePassManager &MPM, OptimizationLevel Level) {
|
||||||
|
#if LLVM_VERSION_GE(14, 0)
|
||||||
|
MPM.addPass(ModuleMemorySanitizerPass(Options));
|
||||||
|
#else
|
||||||
MPM.addPass(MemorySanitizerPass(Options));
|
MPM.addPass(MemorySanitizerPass(Options));
|
||||||
MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass(Options)));
|
MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass(Options)));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
@@ -897,8 +901,12 @@ LLVMRustOptimizeWithNewPassManager(
|
|||||||
#if LLVM_VERSION_GE(11, 0)
|
#if LLVM_VERSION_GE(11, 0)
|
||||||
OptimizerLastEPCallbacks.push_back(
|
OptimizerLastEPCallbacks.push_back(
|
||||||
[](ModulePassManager &MPM, OptimizationLevel Level) {
|
[](ModulePassManager &MPM, OptimizationLevel Level) {
|
||||||
|
#if LLVM_VERSION_GE(14, 0)
|
||||||
|
MPM.addPass(ModuleThreadSanitizerPass());
|
||||||
|
#else
|
||||||
MPM.addPass(ThreadSanitizerPass());
|
MPM.addPass(ThreadSanitizerPass());
|
||||||
MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass()));
|
MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass()));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
#else
|
#else
|
||||||
|
|||||||
Reference in New Issue
Block a user