Skip to content

Commit a97f89a

Browse files
committed
PassWrapper: handle separate Module*SanitizerPass
Change ab41eef 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
1 parent 2b5ddf3 commit a97f89a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -875,8 +875,12 @@ LLVMRustOptimizeWithNewPassManager(
875875
#if LLVM_VERSION_GE(11, 0)
876876
OptimizerLastEPCallbacks.push_back(
877877
[Options](ModulePassManager &MPM, OptimizationLevel Level) {
878+
#if LLVM_VERSION_GE(14, 0)
879+
MPM.addPass(ModuleMemorySanitizerPass(Options));
880+
#else
878881
MPM.addPass(MemorySanitizerPass(Options));
879882
MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass(Options)));
883+
#endif
880884
}
881885
);
882886
#else
@@ -897,8 +901,12 @@ LLVMRustOptimizeWithNewPassManager(
897901
#if LLVM_VERSION_GE(11, 0)
898902
OptimizerLastEPCallbacks.push_back(
899903
[](ModulePassManager &MPM, OptimizationLevel Level) {
904+
#if LLVM_VERSION_GE(14, 0)
905+
MPM.addPass(ModuleThreadSanitizerPass());
906+
#else
900907
MPM.addPass(ThreadSanitizerPass());
901908
MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass()));
909+
#endif
902910
}
903911
);
904912
#else

0 commit comments

Comments
 (0)