File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
compiler/rustc_llvm/llvm-wrapper Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -700,6 +700,10 @@ struct LLVMRustSanitizerOptions {
700700#ifdef ENZYME
701701extern " C" void registerEnzymeAndPassPipeline (llvm::PassBuilder &PB,
702702 /* augmentPassBuilder */ bool );
703+
704+ extern " C" {
705+ extern llvm::cl::opt<std::string> EnzymeFunctionToAnalyze;
706+ }
703707#endif
704708
705709extern " C" LLVMRustResult LLVMRustOptimize (
@@ -1069,6 +1073,15 @@ extern "C" LLVMRustResult LLVMRustOptimize(
10691073 return LLVMRustResult::Failure;
10701074 }
10711075
1076+ // Check if PrintTAFn was used and add type analysis pass if needed
1077+ if (!EnzymeFunctionToAnalyze.empty ()) {
1078+ if (auto Err = PB.parsePassPipeline (MPM, " print-type-analysis" )) {
1079+ std::string ErrMsg = toString (std::move (Err));
1080+ LLVMRustSetLastError (ErrMsg.c_str ());
1081+ return LLVMRustResult::Failure;
1082+ }
1083+ }
1084+
10721085 if (PrintAfterEnzyme) {
10731086 // Handle the Rust flag `-Zautodiff=PrintModAfter`.
10741087 std::string Banner = " Module after EnzymeNewPM" ;
You can’t perform that action at this time.
0 commit comments