Skip to content

Commit 4a52f5a

Browse files
committed
[ownership] Add another run of SemanticARCOpts right before eliminating ARC on the stdlib functions.
This just canonicalizes the ARC before we lower OME in the face of ARC twiddles by other passes.
1 parent 3cd6a65 commit 4a52f5a

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ void addFunctionPasses(SILPassPipelinePlan &P,
300300
P.addMem2Reg();
301301

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

306307
// Run the existential specializer Pass.

lib/SILOptimizer/SemanticARC/SemanticARCOpts.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ struct SemanticARCOpts : SILFunctionTransform {
100100
void run() override {
101101
SILFunction &f = *getFunction();
102102

103-
// Return early if we are not performing OSSA optimizations.
104-
if (!f.getModule().getOptions().EnableOSSAOptimizations)
103+
// Return early if we are not performing OSSA optimizations or we are not in
104+
// ownership.
105+
if (!f.getModule().getOptions().EnableOSSAOptimizations ||
106+
!f.hasOwnership())
105107
return;
106108

107109
// Make sure we are running with ownership verification enabled.

0 commit comments

Comments
 (0)