about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm
diff options
context:
space:
mode:
authorManuel Drehwald <git@manuel.drehwald.info>2025-02-07 22:27:46 -0500
committerManuel Drehwald <git@manuel.drehwald.info>2025-02-07 22:27:46 -0500
commit21d096184e3c7e05646ee756a2ff6a99e90aff77 (patch)
tree1283233efc1afd123c360e1d41dc81574ad5dd90 /compiler/rustc_codegen_llvm
parenta6e55271fbc27bc605ba08c5f4e7b64719909ab0 (diff)
downloadrust-21d096184e3c7e05646ee756a2ff6a99e90aff77.tar.gz
rust-21d096184e3c7e05646ee756a2ff6a99e90aff77.zip
fix non-enzyme builds
Diffstat (limited to 'compiler/rustc_codegen_llvm')
-rw-r--r--compiler/rustc_codegen_llvm/src/back/write.rs4
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm/ffi.rs1
2 files changed, 4 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_llvm/src/back/write.rs b/compiler/rustc_codegen_llvm/src/back/write.rs
index 4706744f353..155c07ff635 100644
--- a/compiler/rustc_codegen_llvm/src/back/write.rs
+++ b/compiler/rustc_codegen_llvm/src/back/write.rs
@@ -551,11 +551,12 @@ pub(crate) unsafe fn llvm_optimize(
     let vectorize_slp;
     let vectorize_loop;
 
+    let run_enzyme = cfg!(llvm_enzyme);
     // When we build rustc with enzyme/autodiff support, we want to postpone size-increasing
     // optimizations until after differentiation. FIXME(ZuseZ4): Before shipping on nightly,
     // we should make this more granular, or at least check that the user has at least one autodiff
     // call in their code, to justify altering the compilation pipeline.
-    if skip_size_increasing_opts && cfg!(llvm_enzyme) {
+    if skip_size_increasing_opts && run_enzyme {
         unroll_loops = false;
         vectorize_slp = false;
         vectorize_loop = false;
@@ -633,6 +634,7 @@ pub(crate) unsafe fn llvm_optimize(
             vectorize_loop,
             config.no_builtins,
             config.emit_lifetime_markers,
+            run_enzyme,
             sanitizer_options.as_ref(),
             pgo_gen_path.as_ref().map_or(std::ptr::null(), |s| s.as_ptr()),
             pgo_use_path.as_ref().map_or(std::ptr::null(), |s| s.as_ptr()),
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
index cc7c5231aca..f2af400ce38 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
@@ -2346,6 +2346,7 @@ unsafe extern "C" {
         LoopVectorize: bool,
         DisableSimplifyLibCalls: bool,
         EmitLifetimeMarkers: bool,
+        RunEnzyme: bool,
         SanitizerOptions: Option<&SanitizerOptions>,
         PGOGenPath: *const c_char,
         PGOUsePath: *const c_char,