Skip to content

Commit b385332

Browse files
authored
Merge pull request swiftlang#34413 from gottesmm/pr-125681629f67f2d2cfe3cde57c7f890bad4ed299
[ownership] Add another run of SemanticARCOpts right before eliminating ARC on the stdlib functions.
2 parents 35f856f + 4a52f5a commit b385332

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)