@@ -713,7 +713,7 @@ extern "C" LLVMRustResult LLVMRustOptimize(
713713 LLVMModuleRef ModuleRef, LLVMTargetMachineRef TMRef,
714714 LLVMRustPassBuilderOptLevel OptLevelRust, LLVMRustOptStage OptStage,
715715 bool IsLinkerPluginLTO, bool NoPrepopulatePasses, bool VerifyIR,
716- bool UseThinLTOBuffers, bool MergeFunctions, bool UnrollLoops,
716+ bool LintIR, bool UseThinLTOBuffers, bool MergeFunctions, bool UnrollLoops,
717717 bool SLPVectorize, bool LoopVectorize, bool DisableSimplifyLibCalls,
718718 bool EmitLifetimeMarkers, LLVMRustSanitizerOptions *SanitizerOptions,
719719 const char *PGOGenPath, const char *PGOUsePath, bool InstrumentCoverage,
@@ -842,6 +842,13 @@ extern "C" LLVMRustResult LLVMRustOptimize(
842842 });
843843 }
844844
845+ if (LintIR) {
846+ PipelineStartEPCallbacks.push_back (
847+ [](ModulePassManager &MPM, OptimizationLevel Level) {
848+ MPM.addPass (createModuleToFunctionPassAdaptor (LintPass ()));
849+ });
850+ }
851+
845852 if (InstrumentGCOV) {
846853 PipelineStartEPCallbacks.push_back (
847854 [](ModulePassManager &MPM, OptimizationLevel Level) {
0 commit comments