@@ -247,7 +247,7 @@ bool SILPassManager::continueTransforming() {
247
247
}
248
248
249
249
bool SILPassManager::analysesUnlocked () {
250
- for (auto A : Analysis)
250
+ for (auto * A : Analysis)
251
251
if (A->isLocked ())
252
252
return false ;
253
253
@@ -481,7 +481,7 @@ void SILPassManager::runOneIteration() {
481
481
}
482
482
NumOptzIterations++;
483
483
NumOptimizationIterations++;
484
- SmallVector<SILFunctionTransform*, 16 > PendingFuncTransforms;
484
+ SmallVector<SILFunctionTransform *, 16 > PendingFuncTransforms;
485
485
486
486
// Run the transforms by alternating between function transforms and
487
487
// module transforms. We'll queue up all the function transforms
@@ -542,11 +542,11 @@ void SILPassManager::run() {
542
542
// / D'tor.
543
543
SILPassManager::~SILPassManager () {
544
544
// Free all transformations.
545
- for (auto T : Transformations)
545
+ for (auto * T : Transformations)
546
546
delete T;
547
547
548
548
// delete the analysis.
549
- for (auto A : Analysis) {
549
+ for (auto * A : Analysis) {
550
550
Mod->removeDeleteNotificationHandler (A);
551
551
assert (!A->isLocked () &&
552
552
" Deleting a locked analysis. Did we forget to unlock ?" );
@@ -559,10 +559,29 @@ void SILPassManager::addFunctionToWorklist(SILFunction *F,
559
559
assert (F && F->isDefinition () && F->shouldOptimize () &&
560
560
" Expected optimizable function definition!" );
561
561
562
- const int MaxDeriveLevels = 10 ;
562
+ constexpr int MaxDeriveLevels = 10 ;
563
563
564
564
int NewLevel = 1 ;
565
565
if (DerivedFrom) {
566
+ // When SILVerifyAll is enabled, individual functions are verified after
567
+ // function passes are run upon them. This means that any functions created
568
+ // by a function pass will not be verified after the pass runs. Thus
569
+ // specialization errors that cause the verifier to trip will be
570
+ // misattributed to the first pass that makes a change to the specialized
571
+ // function. This is very misleading and increases triage time.
572
+ //
573
+ // As a result, when SILVerifyAll is enabled, we always verify newly
574
+ // specialized functions as they are added to the worklist.
575
+ //
576
+ // TODO: Currently, all specialized functions are added to the function
577
+ // worklist in this manner. This is all well and good, but we should really
578
+ // add support for verifying that all specialized functions are added via
579
+ // this function to the pass manager to ensure that we perform this
580
+ // verification.
581
+ if (getOptions ().VerifyAll ) {
582
+ F->verify ();
583
+ }
584
+
566
585
NewLevel = DerivationLevels[DerivedFrom] + 1 ;
567
586
// Limit the number of derivations, i.e. don't allow that a pass specializes
568
587
// a specialized function which is itself a specialized function, and so on.
@@ -590,7 +609,7 @@ void SILPassManager::restartWithCurrentFunction(SILTransform *T) {
590
609
// / \brief Reset the state of the pass manager and remove all transformation
591
610
// / owned by the pass manager. Analysis passes will be kept.
592
611
void SILPassManager::resetAndRemoveTransformations () {
593
- for (auto T : Transformations)
612
+ for (auto * T : Transformations)
594
613
delete T;
595
614
596
615
Transformations.clear ();
0 commit comments