40
40
#include " llvm/Transforms/Instrumentation/AddressSanitizer.h"
41
41
#include " llvm/Transforms/Scalar/LoopPassManager.h"
42
42
#include " llvm/Transforms/Utils/Debugify.h"
43
+ #include " llvm/Transforms/Utils/ProfileValidation.h"
43
44
44
45
using namespace llvm ;
45
46
using namespace opt_tool ;
@@ -356,7 +357,7 @@ bool llvm::runPassPipeline(
356
357
OutputKind OK, VerifierKind VK, bool ShouldPreserveAssemblyUseListOrder,
357
358
bool ShouldPreserveBitcodeUseListOrder, bool EmitSummaryIndex,
358
359
bool EmitModuleHash, bool EnableDebugify, bool VerifyDIPreserve,
359
- bool UnifiedLTO) {
360
+ bool EnableProfcheck, bool UnifiedLTO) {
360
361
auto FS = vfs::getRealFileSystem ();
361
362
std::optional<PGOOptions> P;
362
363
switch (PGOKindFlag) {
@@ -487,7 +488,8 @@ bool llvm::runPassPipeline(
487
488
if (VerifyDIPreserve)
488
489
MPM.addPass (NewPMDebugifyPass (DebugifyMode::OriginalDebugInfo, " " ,
489
490
&DebugInfoBeforePass));
490
-
491
+ if (EnableProfcheck)
492
+ MPM.addPass (createModuleToFunctionPassAdaptor (ProfileInjectorPass ()));
491
493
// Add passes according to the -passes options.
492
494
if (!PassPipeline.empty ()) {
493
495
if (auto Err = PB.parsePassPipeline (MPM, PassPipeline)) {
@@ -504,6 +506,8 @@ bool llvm::runPassPipeline(
504
506
MPM.addPass (NewPMCheckDebugifyPass (
505
507
false , " " , nullptr , DebugifyMode::OriginalDebugInfo,
506
508
&DebugInfoBeforePass, VerifyDIPreserveExport));
509
+ if (EnableProfcheck)
510
+ MPM.addPass (createModuleToFunctionPassAdaptor (ProfileVerifierPass ()));
507
511
508
512
// Add any relevant output pass at the end of the pipeline.
509
513
switch (OK) {
0 commit comments