Skip to content

Commit

Permalink
[ownership] Add another run of SemanticARCOpts right before eliminati…
Browse files Browse the repository at this point in the history
…ng ARC on the stdlib functions.

This just canonicalizes the ARC before we lower OME in the face of ARC twiddles
by other passes.
  • Loading branch information
gottesmm committed Oct 23, 2020
1 parent 3cd6a65 commit 4a52f5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/SILOptimizer/PassManager/PassPipeline.cpp
Expand Up @@ -300,7 +300,8 @@ void addFunctionPasses(SILPassPipelinePlan &P,
P.addMem2Reg();

// We earlier eliminated ownership if we are not compiling the stdlib. Now
// handle the stdlib functions.
// handle the stdlib functions, re-simplifying, eliminating ARC as we do.
P.addSemanticARCOpts();
P.addNonTransparentFunctionOwnershipModelEliminator();

// Run the existential specializer Pass.
Expand Down
6 changes: 4 additions & 2 deletions lib/SILOptimizer/SemanticARC/SemanticARCOpts.cpp
Expand Up @@ -100,8 +100,10 @@ struct SemanticARCOpts : SILFunctionTransform {
void run() override {
SILFunction &f = *getFunction();

// Return early if we are not performing OSSA optimizations.
if (!f.getModule().getOptions().EnableOSSAOptimizations)
// Return early if we are not performing OSSA optimizations or we are not in
// ownership.
if (!f.getModule().getOptions().EnableOSSAOptimizations ||
!f.hasOwnership())
return;

// Make sure we are running with ownership verification enabled.
Expand Down

0 comments on commit 4a52f5a

Please sign in to comment.