about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
diff options
context:
space:
mode:
authorManuel Drehwald <git@manuel.drehwald.info>2025-02-10 01:35:22 -0500
committerManuel Drehwald <git@manuel.drehwald.info>2025-02-10 01:35:22 -0500
commit1221cff55149d2dbbf8761345799ef06f8099b97 (patch)
treeb21703aa4527bad47c9cff195845ef7d0b04d3a4 /compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
parent21d096184e3c7e05646ee756a2ff6a99e90aff77 (diff)
downloadrust-1221cff55149d2dbbf8761345799ef06f8099b97.tar.gz
rust-1221cff55149d2dbbf8761345799ef06f8099b97.zip
move second opt run to lto phase and cleanup code
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
index 0e591786d91..a6b2384f2d7 100644
--- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp
@@ -689,7 +689,9 @@ struct LLVMRustSanitizerOptions {
 };
 
 // This symbol won't be available or used when Enzyme is not enabled
-extern "C" void registerEnzyme(llvm::PassBuilder &PB) __attribute__((weak));
+#ifdef ENZYME
+extern "C" void registerEnzyme(llvm::PassBuilder &PB);
+#endif
 
 extern "C" LLVMRustResult LLVMRustOptimize(
     LLVMModuleRef ModuleRef, LLVMTargetMachineRef TMRef,
@@ -697,8 +699,9 @@ extern "C" LLVMRustResult LLVMRustOptimize(
     bool IsLinkerPluginLTO, bool NoPrepopulatePasses, bool VerifyIR,
     bool LintIR, bool UseThinLTOBuffers, bool MergeFunctions, bool UnrollLoops,
     bool SLPVectorize, bool LoopVectorize, bool DisableSimplifyLibCalls,
-    bool EmitLifetimeMarkers, bool RunEnzyme, LLVMRustSanitizerOptions *SanitizerOptions,
-    const char *PGOGenPath, const char *PGOUsePath, bool InstrumentCoverage,
+    bool EmitLifetimeMarkers, bool RunEnzyme,
+    LLVMRustSanitizerOptions *SanitizerOptions, const char *PGOGenPath,
+    const char *PGOUsePath, bool InstrumentCoverage,
     const char *InstrProfileOutput, const char *PGOSampleUsePath,
     bool DebugInfoForProfiling, void *LlvmSelfProfiler,
     LLVMRustSelfProfileBeforePassCallback BeforePassCallback,
@@ -1014,6 +1017,7 @@ extern "C" LLVMRustResult LLVMRustOptimize(
   }
 
   // now load "-enzyme" pass:
+#ifdef ENZYME
   if (RunEnzyme) {
     registerEnzyme(PB);
     if (auto Err = PB.parsePassPipeline(MPM, "enzyme")) {
@@ -1022,6 +1026,7 @@ extern "C" LLVMRustResult LLVMRustOptimize(
       return LLVMRustResult::Failure;
     }
   }
+#endif
 
   // Upgrade all calls to old intrinsics first.
   for (Module::iterator I = TheModule->begin(), E = TheModule->end(); I != E;)