diff options
| author | bors <bors@rust-lang.org> | 2024-11-05 18:58:59 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2024-11-05 18:58:59 +0000 |
| commit | bc5cf994db9fb46712cefd89f78ad7fc51f184a2 (patch) | |
| tree | c851b26b6244ab45bf57cfd07d9d74309cdb2edd /compiler/rustc_llvm/llvm-wrapper | |
| parent | e8c698bb3bdc121ac7f65919bd16d22f6567a3f1 (diff) | |
| parent | 5b1c6264e0b51c263d9e7e2077011d531431fbad (diff) | |
| download | rust-bc5cf994db9fb46712cefd89f78ad7fc51f184a2.tar.gz rust-bc5cf994db9fb46712cefd89f78ad7fc51f184a2.zip | |
Auto merge of #132631 - workingjubilee:rollup-dx0krqp, r=workingjubilee
Rollup of 4 pull requests Successful merges: - #132153 (Stabilise `const_char_encode_utf16`.) - #132473 ([core/fmt] Replace checked slice indexing by unchecked to support panic-free code) - #132600 (PassWrapper: adapt for new parameter in LLVM) - #132630 (triagebot: ping wg-const-eval when relevant files change) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 5d2df6ddfc9..eb99d560e57 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -784,8 +784,14 @@ extern "C" LLVMRustResult LLVMRustOptimize( // the PassBuilder does not create a pipeline. std::vector<std::function<void(ModulePassManager &, OptimizationLevel)>> PipelineStartEPCallbacks; +#if LLVM_VERSION_GE(20, 0) + std::vector<std::function<void(ModulePassManager &, OptimizationLevel, + ThinOrFullLTOPhase)>> + OptimizerLastEPCallbacks; +#else std::vector<std::function<void(ModulePassManager &, OptimizationLevel)>> OptimizerLastEPCallbacks; +#endif if (!IsLinkerPluginLTO && SanitizerOptions && SanitizerOptions->SanitizeCFI && !NoPrepopulatePasses) { @@ -832,7 +838,12 @@ extern "C" LLVMRustResult LLVMRustOptimize( SanitizerOptions->SanitizeDataFlowABIList + SanitizerOptions->SanitizeDataFlowABIListLen); OptimizerLastEPCallbacks.push_back( +#if LLVM_VERSION_GE(20, 0) + [ABIListFiles](ModulePassManager &MPM, OptimizationLevel Level, + ThinOrFullLTOPhase phase) { +#else [ABIListFiles](ModulePassManager &MPM, OptimizationLevel Level) { +#endif MPM.addPass(DataFlowSanitizerPass(ABIListFiles)); }); } @@ -844,23 +855,39 @@ extern "C" LLVMRustResult LLVMRustOptimize( /*CompileKernel=*/false, /*EagerChecks=*/true); OptimizerLastEPCallbacks.push_back( +#if LLVM_VERSION_GE(20, 0) + [Options](ModulePassManager &MPM, OptimizationLevel Level, + ThinOrFullLTOPhase phase) { +#else [Options](ModulePassManager &MPM, OptimizationLevel Level) { +#endif MPM.addPass(MemorySanitizerPass(Options)); }); } if (SanitizerOptions->SanitizeThread) { - OptimizerLastEPCallbacks.push_back([](ModulePassManager &MPM, - OptimizationLevel Level) { - MPM.addPass(ModuleThreadSanitizerPass()); - MPM.addPass(createModuleToFunctionPassAdaptor(ThreadSanitizerPass())); - }); + OptimizerLastEPCallbacks.push_back( +#if LLVM_VERSION_GE(20, 0) + [](ModulePassManager &MPM, OptimizationLevel Level, + ThinOrFullLTOPhase phase) { +#else + [](ModulePassManager &MPM, OptimizationLevel Level) { +#endif + MPM.addPass(ModuleThreadSanitizerPass()); + MPM.addPass( + createModuleToFunctionPassAdaptor(ThreadSanitizerPass())); + }); } if (SanitizerOptions->SanitizeAddress || SanitizerOptions->SanitizeKernelAddress) { OptimizerLastEPCallbacks.push_back( +#if LLVM_VERSION_GE(20, 0) + [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level, + ThinOrFullLTOPhase phase) { +#else [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) { +#endif auto CompileKernel = SanitizerOptions->SanitizeKernelAddress; AddressSanitizerOptions opts = AddressSanitizerOptions{ CompileKernel, @@ -874,7 +901,12 @@ extern "C" LLVMRustResult LLVMRustOptimize( } if (SanitizerOptions->SanitizeHWAddress) { OptimizerLastEPCallbacks.push_back( +#if LLVM_VERSION_GE(20, 0) + [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level, + ThinOrFullLTOPhase phase) { +#else [SanitizerOptions](ModulePassManager &MPM, OptimizationLevel Level) { +#endif HWAddressSanitizerOptions opts( /*CompileKernel=*/false, SanitizerOptions->SanitizeHWAddressRecover, @@ -935,7 +967,11 @@ extern "C" LLVMRustResult LLVMRustOptimize( for (const auto &C : PipelineStartEPCallbacks) C(MPM, OptLevel); for (const auto &C : OptimizerLastEPCallbacks) +#if LLVM_VERSION_GE(20, 0) + C(MPM, OptLevel, ThinOrFullLTOPhase::None); +#else C(MPM, OptLevel); +#endif } if (ExtraPassesLen) { |
