diff options
| author | Manuel Drehwald <git@manuel.drehwald.info> | 2025-02-07 22:27:46 -0500 | 
|---|---|---|
| committer | Manuel Drehwald <git@manuel.drehwald.info> | 2025-02-07 22:27:46 -0500 | 
| commit | 21d096184e3c7e05646ee756a2ff6a99e90aff77 (patch) | |
| tree | 1283233efc1afd123c360e1d41dc81574ad5dd90 /compiler/rustc_llvm/llvm-wrapper | |
| parent | a6e55271fbc27bc605ba08c5f4e7b64719909ab0 (diff) | |
| download | rust-21d096184e3c7e05646ee756a2ff6a99e90aff77.tar.gz rust-21d096184e3c7e05646ee756a2ff6a99e90aff77.zip | |
fix non-enzyme builds
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp | 17 | 
1 files changed, 10 insertions, 7 deletions
| diff --git a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp index 0063f262c9b..0e591786d91 100644 --- a/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/PassWrapper.cpp @@ -688,7 +688,8 @@ struct LLVMRustSanitizerOptions { bool SanitizeKernelAddressRecover; }; -extern "C" void registerEnzyme(llvm::PassBuilder &PB); +// This symbol won't be available or used when Enzyme is not enabled +extern "C" void registerEnzyme(llvm::PassBuilder &PB) __attribute__((weak)); extern "C" LLVMRustResult LLVMRustOptimize( LLVMModuleRef ModuleRef, LLVMTargetMachineRef TMRef, @@ -696,7 +697,7 @@ 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, LLVMRustSanitizerOptions *SanitizerOptions, + bool EmitLifetimeMarkers, bool RunEnzyme, LLVMRustSanitizerOptions *SanitizerOptions, const char *PGOGenPath, const char *PGOUsePath, bool InstrumentCoverage, const char *InstrProfileOutput, const char *PGOSampleUsePath, bool DebugInfoForProfiling, void *LlvmSelfProfiler, @@ -1013,11 +1014,13 @@ extern "C" LLVMRustResult LLVMRustOptimize( } // now load "-enzyme" pass: - registerEnzyme(PB); - if (auto Err = PB.parsePassPipeline(MPM, "enzyme")) { - std::string ErrMsg = toString(std::move(Err)); - LLVMRustSetLastError(ErrMsg.c_str()); - return LLVMRustResult::Failure; + if (RunEnzyme) { + registerEnzyme(PB); + if (auto Err = PB.parsePassPipeline(MPM, "enzyme")) { + std::string ErrMsg = toString(std::move(Err)); + LLVMRustSetLastError(ErrMsg.c_str()); + return LLVMRustResult::Failure; + } } // Upgrade all calls to old intrinsics first. | 
