File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
include/swift/SILOptimizer/Analysis
lib/SILOptimizer/PassManager Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -137,6 +137,18 @@ class SILAnalysis : public DeleteNotificationHandler {
137
137
// / specific verification will do so.
138
138
virtual void verify (SILFunction *F) const { verify (); }
139
139
140
+ // / Perform a potentially more expensive verification of the state of this
141
+ // / analysis.
142
+ // /
143
+ // / The purpose of this is to allow for more expensive verification that is
144
+ // / fast enough to run at the end of a pass manager once vs in between all
145
+ // / passes when -sil-verify-all is enabled.
146
+ // /
147
+ // / TODO: By default this is a no-op, but really it should call
148
+ // / verify(). Today doing a full verification seems to catch verification
149
+ // / errors when compiling the stdlib/overlays.
150
+ virtual void verifyFull () const {}
151
+
140
152
// / Verify that the function \p F can be used by the analysis.
141
153
static void verifyFunction (SILFunction *F);
142
154
};
Original file line number Diff line number Diff line change @@ -568,6 +568,22 @@ void SILPassManager::execute() {
568
568
SILPassManager::~SILPassManager () {
569
569
assert (IRGenPasses.empty () && " Must add IRGen SIL passes that were "
570
570
" registered to the list of transformations" );
571
+ // Before we do anything further, verify the module and our analyses. These
572
+ // are natural points with which to verify.
573
+ //
574
+ // TODO: We currently do not verify the module here since the verifier asserts
575
+ // in the normal build. This should be enabled and those problems resolved
576
+ // either by changing the verifier or treating those asserts as signs of a
577
+ // bug.
578
+ for (auto *A : Analyses) {
579
+ // We use verify full instead of just verify to ensure that passes that want
580
+ // to run more expensive verification after a pass manager is destroyed
581
+ // properly trigger.
582
+ //
583
+ // NOTE: verifyFull() has a default implementation that just calls
584
+ // verify(). So functionally, there is no difference here.
585
+ A->verifyFull ();
586
+ }
571
587
572
588
// Remove our deserialization notification handler.
573
589
Mod->removeDeserializationNotificationHandler (
You can’t perform that action at this time.
0 commit comments