diff options
| author | Krasimir Georgiev <krasimir@google.com> | 2022-09-07 12:08:06 +0000 |
|---|---|---|
| committer | Krasimir Georgiev <krasimir@google.com> | 2022-09-07 13:37:59 +0000 |
| commit | a3b60f1769303cad5221e44f8a0c4d76182db346 (patch) | |
| tree | fac1d0b69e421e0a9236e5e8fc1f2db41faafc5e /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | |
| parent | 0568b0a3de4eb37bf187eb61a9f017ae0018ad8f (diff) | |
| download | rust-a3b60f1769303cad5221e44f8a0c4d76182db346.tar.gz rust-a3b60f1769303cad5221e44f8a0c4d76182db346.zip | |
llvm-wrapper: adapt for LLVM API changes
No functional changes intended. Adapts PassWrapper for two recent LLVM API changes: * https://github.com/llvm/llvm-project/commit/e7bac3b9fa739f8d167a390a547068aad1d424a7 * https://github.com/llvm/llvm-project/commit/93600eb50ceeec83c488ded24fa0fd25f997fec6 * https://github.com/llvm/llvm-project/commit/5e38b2a456df6e263a509af60a731cec57310498
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 05d2a214d0b..bc49dfe7eae 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -936,12 +936,14 @@ LLVMRustOptimizeWithNewPassManager( /*CompileKernel=*/false); OptimizerLastEPCallbacks.push_back( [Options](ModulePassManager &MPM, OptimizationLevel Level) { -#if LLVM_VERSION_GE(14, 0) +#if LLVM_VERSION_GE(14, 0) && LLVM_VERSION_LT(16, 0) MPM.addPass(ModuleMemorySanitizerPass(Options)); #else MPM.addPass(MemorySanitizerPass(Options)); #endif +#if LLVM_VERSION_LT(16, 0) MPM.addPass(createModuleToFunctionPassAdaptor(MemorySanitizerPass(Options))); +#endif } ); } @@ -972,8 +974,12 @@ LLVMRustOptimizeWithNewPassManager( /*UseAfterScope=*/true, AsanDetectStackUseAfterReturnMode::Runtime, }; +#if LLVM_VERSION_LT(16, 0) MPM.addPass(ModuleAddressSanitizerPass(opts)); #else + MPM.addPass(AddressSanitizerPass(opts)); +#endif +#else MPM.addPass(ModuleAddressSanitizerPass( /*CompileKernel=*/false, SanitizerOptions->SanitizeAddressRecover)); MPM.addPass(createModuleToFunctionPassAdaptor(AddressSanitizerPass( |
