@@ -704,19 +704,21 @@ struct LLVMRustSanitizerOptions {
704704extern " C" void registerEnzymeAndPassPipeline (llvm::PassBuilder &PB,
705705 /* augmentPassBuilder */ bool );
706706
707- extern " C" {
708- extern llvm::cl::opt<std::string> EnzymeFunctionToAnalyze;
709- }
707+ // extern "C" {
708+ // extern llvm::cl::opt<std::string> EnzymeFunctionToAnalyze;
709+ // }
710710#endif
711711
712+ extern " C" typedef void (*registerEnzymeAndPassPipelineFn)(llvm::PassBuilder &PB, bool augment);
713+
712714extern " C" LLVMRustResult LLVMRustOptimize (
713715 LLVMModuleRef ModuleRef, LLVMTargetMachineRef TMRef,
714716 LLVMRustPassBuilderOptLevel OptLevelRust, LLVMRustOptStage OptStage,
715717 bool IsLinkerPluginLTO, bool NoPrepopulatePasses, bool VerifyIR,
716718 bool LintIR, LLVMRustThinLTOBuffer **ThinLTOBufferRef, bool EmitThinLTO,
717719 bool EmitThinLTOSummary, bool MergeFunctions, bool UnrollLoops,
718720 bool SLPVectorize, bool LoopVectorize, bool DisableSimplifyLibCalls,
719- bool EmitLifetimeMarkers, bool RunEnzyme , bool PrintBeforeEnzyme,
721+ bool EmitLifetimeMarkers, registerEnzymeAndPassPipelineFn EnzymePtr , bool PrintBeforeEnzyme,
720722 bool PrintAfterEnzyme, bool PrintPasses,
721723 LLVMRustSanitizerOptions *SanitizerOptions, const char *PGOGenPath,
722724 const char *PGOUsePath, bool InstrumentCoverage,
@@ -1061,29 +1063,30 @@ extern "C" LLVMRustResult LLVMRustOptimize(
10611063
10621064 // now load "-enzyme" pass:
10631065#ifdef ENZYME
1064- if (RunEnzyme ) {
1066+ if (EnzymePtr ) {
10651067
10661068 if (PrintBeforeEnzyme) {
10671069 // Handle the Rust flag `-Zautodiff=PrintModBefore`.
10681070 std::string Banner = " Module before EnzymeNewPM" ;
10691071 MPM.addPass (PrintModulePass (outs (), Banner, true , false ));
10701072 }
10711073
1072- registerEnzymeAndPassPipeline (PB, false );
1074+ EnzymePtr (PB, false );
1075+ // registerEnzymeAndPassPipeline(PB, false);
10731076 if (auto Err = PB.parsePassPipeline (MPM, " enzyme" )) {
10741077 std::string ErrMsg = toString (std::move (Err));
10751078 LLVMRustSetLastError (ErrMsg.c_str ());
10761079 return LLVMRustResult::Failure;
10771080 }
10781081
10791082 // Check if PrintTAFn was used and add type analysis pass if needed
1080- if (!EnzymeFunctionToAnalyze.empty ()) {
1081- if (auto Err = PB.parsePassPipeline (MPM, " print-type-analysis" )) {
1082- std::string ErrMsg = toString (std::move (Err));
1083- LLVMRustSetLastError (ErrMsg.c_str ());
1084- return LLVMRustResult::Failure;
1085- }
1086- }
1083+ // if (!EnzymeFunctionToAnalyze.empty()) {
1084+ // if (auto Err = PB.parsePassPipeline(MPM, "print-type-analysis")) {
1085+ // std::string ErrMsg = toString(std::move(Err));
1086+ // LLVMRustSetLastError(ErrMsg.c_str());
1087+ // return LLVMRustResult::Failure;
1088+ // }
1089+ // }
10871090
10881091 if (PrintAfterEnzyme) {
10891092 // Handle the Rust flag `-Zautodiff=PrintModAfter`.
0 commit comments