about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/back/lto.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-04-05 03:09:33 +0000
committerbors <bors@rust-lang.org>2025-04-05 03:09:33 +0000
commit1e008dd5d83e782ad37fc9cf6824733f824cc8cd (patch)
treef41496f629002b9a8f91afa2b50206a7d485e72f /compiler/rustc_codegen_llvm/src/back/lto.rs
parentbad13a970a136389187dd1cf2f2fc737a8bea5fc (diff)
parente31ce50698b40f36056f1e13f7f320ebdb38a102 (diff)
downloadrust-1e008dd5d83e782ad37fc9cf6824733f824cc8cd.tar.gz
rust-1e008dd5d83e782ad37fc9cf6824733f824cc8cd.zip
Auto merge of #139396 - Zalathar:rollup-lmoqvru, r=Zalathar
Rollup of 11 pull requests

Successful merges:

 - #136457 (Expose algebraic floating point intrinsics)
 - #137880 (Autodiff batching)
 - #137897 (fix pthread-based tls on apple targets)
 - #138024 (Allow optimizing out `panic_bounds_check` in Unicode checks.)
 - #138546 (Add integer to string formatting tests)
 - #138826 (StableMIR: Add `associated_items`.)
 - #138950 (replace extra_filename with strict version hash in metrics file names)
 - #139274 (Rustdoc: typecheck settings.js)
 - #139285 (use lower case to match other error messages)
 - #139341 (Apply `Recovery::Forbidden` when reparsing pasted macro fragments.)
 - #139389 (make `Arguments::as_statically_known_str` doc(hidden))

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/back/lto.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/back/lto.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs
index f083cfbd7d3..a8b49e9552c 100644
--- a/compiler/rustc_codegen_llvm/src/back/lto.rs
+++ b/compiler/rustc_codegen_llvm/src/back/lto.rs
@@ -610,6 +610,8 @@ fn enable_autodiff_settings(ad: &[config::AutoDiff], module: &mut ModuleCodegen<
             }
             // We handle this below
             config::AutoDiff::PrintModAfter => {}
+            // We handle this below
+            config::AutoDiff::PrintModFinal => {}
             // This is required and already checked
             config::AutoDiff::Enable => {}
         }
@@ -657,14 +659,20 @@ pub(crate) fn run_pass_manager(
     }
 
     if cfg!(llvm_enzyme) && enable_ad {
+        // This is the post-autodiff IR, mainly used for testing and educational purposes.
+        if config.autodiff.contains(&config::AutoDiff::PrintModAfter) {
+            unsafe { llvm::LLVMDumpModule(module.module_llvm.llmod()) };
+        }
+
         let opt_stage = llvm::OptStage::FatLTO;
         let stage = write::AutodiffStage::PostAD;
         unsafe {
             write::llvm_optimize(cgcx, dcx, module, None, config, opt_level, opt_stage, stage)?;
         }
 
-        // This is the final IR, so people should be able to inspect the optimized autodiff output.
-        if config.autodiff.contains(&config::AutoDiff::PrintModAfter) {
+        // This is the final IR, so people should be able to inspect the optimized autodiff output,
+        // for manual inspection.
+        if config.autodiff.contains(&config::AutoDiff::PrintModFinal) {
             unsafe { llvm::LLVMDumpModule(module.module_llvm.llmod()) };
         }
     }