diff options
| author | Manuel Drehwald <git@manuel.drehwald.info> | 2025-01-01 21:42:45 +0100 |
|---|---|---|
| committer | Manuel Drehwald <git@manuel.drehwald.info> | 2025-01-01 21:42:45 +0100 |
| commit | d753cbf7793f20229ed7a151d060456a9e1396e9 (patch) | |
| tree | 2a885dd222de7440293c7159de4d4c5f9e82bd45 /compiler/rustc_codegen_llvm/src/back/lto.rs | |
| parent | 372442fe5ff1a2d06f4119f2b2e7d1e42388a0d3 (diff) | |
| download | rust-d753cbf7793f20229ed7a151d060456a9e1396e9.tar.gz rust-d753cbf7793f20229ed7a151d060456a9e1396e9.zip | |
upstream rustc_codegen_llvm changes for enzyme/autodiff
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back/lto.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/back/lto.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index f6d2ec24da6..4adf99e91d0 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -604,7 +604,14 @@ pub(crate) fn run_pass_manager( debug!("running the pass manager"); 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) }?; + + // If this rustc version was build with enzyme/autodiff enabled, and if users applied the + // `#[autodiff]` macro at least once, then we will later call llvm_optimize a second time. + let first_run = true; + debug!("running llvm pm opt pipeline"); + unsafe { + write::llvm_optimize(cgcx, dcx, module, config, opt_level, opt_stage, first_run)?; + } debug!("lto done"); Ok(()) } |
