@@ -704,19 +704,21 @@ struct LLVMRustSanitizerOptions {
704
704
extern " C" void registerEnzymeAndPassPipeline (llvm::PassBuilder &PB,
705
705
/* augmentPassBuilder */ bool );
706
706
707
- extern " C" {
708
- extern llvm::cl::opt<std::string> EnzymeFunctionToAnalyze;
709
- }
707
+ // extern "C" {
708
+ // extern llvm::cl::opt<std::string> EnzymeFunctionToAnalyze;
709
+ // }
710
710
#endif
711
711
712
+ extern " C" typedef void (*registerEnzymeAndPassPipelineFn)(llvm::PassBuilder &PB, bool augment);
713
+
712
714
extern " C" LLVMRustResult LLVMRustOptimize (
713
715
LLVMModuleRef ModuleRef, LLVMTargetMachineRef TMRef,
714
716
LLVMRustPassBuilderOptLevel OptLevelRust, LLVMRustOptStage OptStage,
715
717
bool IsLinkerPluginLTO, bool NoPrepopulatePasses, bool VerifyIR,
716
718
bool LintIR, LLVMRustThinLTOBuffer **ThinLTOBufferRef, bool EmitThinLTO,
717
719
bool EmitThinLTOSummary, bool MergeFunctions, bool UnrollLoops,
718
720
bool SLPVectorize, bool LoopVectorize, bool DisableSimplifyLibCalls,
719
- bool EmitLifetimeMarkers, bool RunEnzyme , bool PrintBeforeEnzyme,
721
+ bool EmitLifetimeMarkers, registerEnzymeAndPassPipelineFn EnzymePtr , bool PrintBeforeEnzyme,
720
722
bool PrintAfterEnzyme, bool PrintPasses,
721
723
LLVMRustSanitizerOptions *SanitizerOptions, const char *PGOGenPath,
722
724
const char *PGOUsePath, bool InstrumentCoverage,
@@ -1061,29 +1063,30 @@ extern "C" LLVMRustResult LLVMRustOptimize(
1061
1063
1062
1064
// now load "-enzyme" pass:
1063
1065
#ifdef ENZYME
1064
- if (RunEnzyme ) {
1066
+ if (EnzymePtr ) {
1065
1067
1066
1068
if (PrintBeforeEnzyme) {
1067
1069
// Handle the Rust flag `-Zautodiff=PrintModBefore`.
1068
1070
std::string Banner = " Module before EnzymeNewPM" ;
1069
1071
MPM.addPass (PrintModulePass (outs (), Banner, true , false ));
1070
1072
}
1071
1073
1072
- registerEnzymeAndPassPipeline (PB, false );
1074
+ EnzymePtr (PB, false );
1075
+ // registerEnzymeAndPassPipeline(PB, false);
1073
1076
if (auto Err = PB.parsePassPipeline (MPM, " enzyme" )) {
1074
1077
std::string ErrMsg = toString (std::move (Err));
1075
1078
LLVMRustSetLastError (ErrMsg.c_str ());
1076
1079
return LLVMRustResult::Failure;
1077
1080
}
1078
1081
1079
1082
// 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
+ // }
1087
1090
1088
1091
if (PrintAfterEnzyme) {
1089
1092
// Handle the Rust flag `-Zautodiff=PrintModAfter`.
0 commit comments