about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/back
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-10-29 19:25:03 +0000
committerbors <bors@rust-lang.org>2024-10-29 19:25:03 +0000
commit1e4f10ba6476e48a42a79b9f846a2d9366525b9e (patch)
tree66c68bd54e4c3891de7c37e48c563a9b79177192 /compiler/rustc_codegen_llvm/src/back
parente473783d90e2289b8a97575fa60d6315f0a318eb (diff)
parent07afe8d12f1c72bdc46f052088922943ca91bcdd (diff)
downloadrust-1e4f10ba6476e48a42a79b9f846a2d9366525b9e.tar.gz
rust-1e4f10ba6476e48a42a79b9f846a2d9366525b9e.zip
Auto merge of #132326 - matthiaskrgr:rollup-ngyw18g, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - #131984 (Stabilize if_let_rescope)
 - #132151 (Ensure that resume arg outlives region bound for coroutines)
 - #132157 (Remove detail from label/note that is already available in other note)
 - #132274 (Cleanup op lookup in HIR typeck)
 - #132319 (cg_llvm: Clean up FFI calls for setting module flags)
 - #132321 (xous: sync: remove `rustc_const_stable` attribute on Condvar and Mutex new())

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back')
-rw-r--r--compiler/rustc_codegen_llvm/src/back/lto.rs21
1 files changed, 3 insertions, 18 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs
index 352d2e1a868..02149e176ea 100644
--- a/compiler/rustc_codegen_llvm/src/back/lto.rs
+++ b/compiler/rustc_codegen_llvm/src/back/lto.rs
@@ -25,7 +25,6 @@ use tracing::{debug, info};
 use crate::back::write::{
     self, CodegenDiagnosticsStage, DiagnosticHandlers, bitcode_section_name, save_temp_bitcode,
 };
-use crate::common::AsCCharPtr;
 use crate::errors::{
     DynamicLinkingWithLTO, LlvmError, LtoBitcodeFromRlib, LtoDisallowed, LtoDylib, LtoProcMacro,
 };
@@ -602,23 +601,9 @@ pub(crate) fn run_pass_manager(
     // This code is based off the code found in llvm's LTO code generator:
     //      llvm/lib/LTO/LTOCodeGenerator.cpp
     debug!("running the pass manager");
-    unsafe {
-        if !llvm::LLVMRustHasModuleFlag(
-            module.module_llvm.llmod(),
-            "LTOPostLink".as_c_char_ptr(),
-            11,
-        ) {
-            llvm::LLVMRustAddModuleFlagU32(
-                module.module_llvm.llmod(),
-                llvm::LLVMModFlagBehavior::Error,
-                c"LTOPostLink".as_ptr(),
-                1,
-            );
-        }
-        let opt_stage = if thin { llvm::OptStage::ThinLTO } else { llvm::OptStage::FatLTO };
-        let opt_level = config.opt_level.unwrap_or(config::OptLevel::No);
-        write::llvm_optimize(cgcx, dcx, module, config, opt_level, opt_stage)?;
-    }
+    let opt_stage = if thin { llvm::OptStage::ThinLTO } else { llvm::OptStage::FatLTO };
+    let opt_level = config.opt_level.unwrap_or(config::OptLevel::No);
+    unsafe { write::llvm_optimize(cgcx, dcx, module, config, opt_level, opt_stage) }?;
     debug!("lto done");
     Ok(())
 }