@@ -213,11 +213,12 @@ template <typename DerivedT, typename TargetMachineT> class CodeGenPassBuilder {
213
213
}
214
214
215
215
template <typename PassT>
216
- void operator ()(PassT &&Pass, StringRef Name = PassT::name()) {
216
+ void operator ()(PassT &&Pass, bool Force = false ,
217
+ StringRef Name = PassT::name()) {
217
218
static_assert ((is_detected<is_function_pass_t , PassT>::value ||
218
219
is_detected<is_module_pass_t , PassT>::value) &&
219
220
" Only module pass and function pass are supported." );
220
- if (!PB.runBeforeAdding (Name))
221
+ if (!Force && ! PB.runBeforeAdding (Name))
221
222
return ;
222
223
223
224
// Add Function Pass
@@ -565,9 +566,12 @@ Error CodeGenPassBuilder<Derived, TargetMachineT>::buildPipeline(
565
566
566
567
{
567
568
AddIRPass addIRPass (MPM, derived ());
568
- addIRPass (RequireAnalysisPass<MachineModuleAnalysis, Module>());
569
- addIRPass (RequireAnalysisPass<ProfileSummaryAnalysis, Module>());
570
- addIRPass (RequireAnalysisPass<CollectorMetadataAnalysis, Module>());
569
+ addIRPass (RequireAnalysisPass<MachineModuleAnalysis, Module>(),
570
+ /* Force=*/ true );
571
+ addIRPass (RequireAnalysisPass<ProfileSummaryAnalysis, Module>(),
572
+ /* Force=*/ true );
573
+ addIRPass (RequireAnalysisPass<CollectorMetadataAnalysis, Module>(),
574
+ /* Force=*/ true );
571
575
addISelPasses (addIRPass);
572
576
}
573
577
@@ -683,7 +687,7 @@ void CodeGenPassBuilder<Derived, TargetMachineT>::addIRPasses(
683
687
// Before running any passes, run the verifier to determine if the input
684
688
// coming from the front-end and/or optimizer is valid.
685
689
if (!Opt.DisableVerify )
686
- addPass (VerifierPass ());
690
+ addPass (VerifierPass (), /* Force= */ true );
687
691
688
692
// Run loop strength reduction before anything else.
689
693
if (getOptLevel () != CodeGenOptLevel::None && !Opt.DisableLSR ) {
@@ -820,7 +824,7 @@ void CodeGenPassBuilder<Derived, TargetMachineT>::addISelPrepare(
820
824
// All passes which modify the LLVM IR are now complete; run the verifier
821
825
// to ensure that the IR is valid.
822
826
if (!Opt.DisableVerify )
823
- addPass (VerifierPass ());
827
+ addPass (VerifierPass (), /* Force= */ true );
824
828
}
825
829
826
830
template <typename Derived, typename TargetMachineT>
0 commit comments