Skip to content

Commit 7bd15bd

Browse files
committed
[ownership] Verify functions before we strip ownership.
Today before/after running optimizations, the driver always verifies the entire SILModule. Sadly since we are stripping ownership in the /middle/ of the pipeline, we do not get the same benefit for ownership SIL. With this change, we verify before we strip ownership to ensure that the code is [ossa] correct /before/ we strip. This will only run in asserts builds unless -sil-verify-all is passed in.
1 parent 934f34d commit 7bd15bd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/SILOptimizer/Transforms/OwnershipModelEliminator.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,9 @@ struct OwnershipModelEliminator : SILModuleTransform {
382382
if (SkipTransparent && F.isTransparent())
383383
continue;
384384

385+
// Verify here to make sure ownership is correct before we strip.
386+
F.verify();
387+
385388
if (stripOwnership(F)) {
386389
auto InvalidKind =
387390
SILAnalysis::InvalidationKind::BranchesAndInstructions;

0 commit comments

Comments
 (0)