@@ -204,6 +204,11 @@ static llvm::cl::opt<DebugOnlyPassNumberOpt, true,
204
204
llvm::cl::location(DebugOnlyPassNumberOptLoc),
205
205
llvm::cl::ValueRequired);
206
206
207
+ static llvm::cl::opt<bool > SILPrintEverySubpass (
208
+ " sil-print-every-subpass" , llvm::cl::init(false ),
209
+ llvm::cl::desc(" Print the function before every subpass run of passes that "
210
+ " have multiple subpasses" ));
211
+
207
212
static bool isInPrintFunctionList (SILFunction *F) {
208
213
for (const std::string &printFnName : SILPrintFunction) {
209
214
if (printFnName == F->getName ())
@@ -478,13 +483,22 @@ bool SILPassManager::continueTransforming() {
478
483
bool SILPassManager::continueWithNextSubpassRun (SILInstruction *forInst,
479
484
SILFunction *function,
480
485
SILTransform *trans) {
486
+ unsigned subPass = numSubpassesRun++;
487
+
488
+ if (forInst && isFunctionSelectedForPrinting (function) &&
489
+ SILPrintEverySubpass) {
490
+ dumpPassInfo (" *** SIL function before " , trans, function);
491
+ if (forInst) {
492
+ llvm::dbgs () << " *** sub-pass " << subPass << " for " << *forInst;
493
+ }
494
+ function->dump (getOptions ().EmitVerboseSIL );
495
+ }
496
+
481
497
if (isMandatory)
482
498
return true ;
483
499
if (NumPassesRun != maxNumPassesToRun - 1 )
484
500
return true ;
485
501
486
- unsigned subPass = numSubpassesRun++;
487
-
488
502
if (subPass == maxNumSubpassesToRun - 1 && SILPrintLast) {
489
503
dumpPassInfo (" *** SIL function before " , trans, function);
490
504
if (forInst) {
0 commit comments