Skip to content

Commit c9d124c

Browse files
committed
Move OME lower for non-transparent functions
Move it just before outliner which has not yet been migrated
1 parent 05dd0e0 commit c9d124c

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,18 @@ static void addPerfEarlyModulePassPipeline(SILPassPipelinePlan &P) {
518518
// not blocked by any other passes' optimizations, so do it early.
519519
P.addDifferentiabilityWitnessDevirtualizer();
520520

521+
// Start by linking in referenced functions from other modules.
522+
P.addPerformanceSILLinker();
523+
524+
// Cleanup after SILGen: remove trivial copies to temporaries. This version of
525+
// temp-rvalue opt is here so that we can hit copies from non-ossa code that
526+
// is linked in from the stdlib.
527+
P.addTempRValueOpt();
528+
529+
// Needed to serialize static initializers of globals for cross-module
530+
// optimization.
531+
P.addGlobalOpt();
532+
521533
// Strip ownership from non-transparent functions when we are not compiling
522534
// the stdlib module. When compiling the stdlib, we eliminate ownership on
523535
// these functions later with a nromal call to
@@ -531,18 +543,6 @@ static void addPerfEarlyModulePassPipeline(SILPassPipelinePlan &P) {
531543
if (!P.getOptions().EnableOSSAModules)
532544
P.addNonTransparentFunctionOwnershipModelEliminator();
533545

534-
// Start by linking in referenced functions from other modules.
535-
P.addPerformanceSILLinker();
536-
537-
// Cleanup after SILGen: remove trivial copies to temporaries. This version of
538-
// temp-rvalue opt is here so that we can hit copies from non-ossa code that
539-
// is linked in from the stdlib.
540-
P.addTempRValueOpt();
541-
542-
// Needed to serialize static initializers of globals for cross-module
543-
// optimization.
544-
P.addGlobalOpt();
545-
546546
// Add the outliner pass (Osize).
547547
P.addOutliner();
548548

test/SILOptimizer/OSLogFullOptTest.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,13 @@ func testNSObjectInterpolation(nsArray: NSArray) {
133133
// TODO: check why the ARC optimizer cannot eliminate the many retain/release pairs here.
134134
// CHECK: entry:
135135
// CHECK-NEXT: bitcast %TSo7NSArrayC* %0 to i8*
136-
// CHECK-NEXT: tail call i8* @llvm.objc.retain
137136
// CHECK-NEXT: [[NSARRAY_ARG:%.+]] = tail call i8* @llvm.objc.retain
138137
// CHECK: tail call swiftcc i1 @"${{.*}}isLoggingEnabled{{.*}}"()
139138
// CHECK-NEXT: br i1 {{%.*}}, label %[[ENABLED:[0-9]+]], label %[[NOT_ENABLED:[0-9]+]]
140139

141140
// CHECK: [[NOT_ENABLED]]:
142141
// CHECK-NEXT: tail call void @swift_release
143142
// CHECK-NEXT: tail call void @llvm.objc.release
144-
// CHECK-NEXT: tail call void @llvm.objc.release
145143
// CHECK-NEXT: br label %[[EXIT:[0-9]+]]
146144

147145
// CHECK: [[ENABLED]]:
@@ -172,7 +170,6 @@ func testNSObjectInterpolation(nsArray: NSArray) {
172170
// CHECK-NEXT: [[BITCASTED_SRC2:%.+]] = bitcast i8* [[NSARRAY_ARG]] to %TSo7NSArrayC*
173171
// CHECK-64-NEXT: store %TSo7NSArrayC* [[BITCASTED_SRC2]], %TSo7NSArrayC** [[BITCASTED_DEST2]], align 8
174172
// CHECK-32-NEXT: store %TSo7NSArrayC* [[BITCASTED_SRC2]], %TSo7NSArrayC** [[BITCASTED_DEST2]], align 4
175-
// CHECK-NEXT: tail call void @llvm.objc.release
176173
// CHECK-64-NEXT: tail call swiftcc void @"${{.*}}_os_log_impl_test{{.*}}"({{.*}}, {{.*}}, {{.*}}, {{.*}}, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @{{.*}}, i64 0, i64 0), i8* {{(nonnull )?}}[[BUFFER]], i32 12)
177174
// CHECK-32-NEXT: tail call swiftcc void @"${{.*}}_os_log_impl_test{{.*}}"({{.*}}, {{.*}}, {{.*}}, {{.*}}, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @{{.*}}, i32 0, i32 0), i8* {{(nonnull )?}}[[BUFFER]], i32 8)
178175
// CHECK-NEXT: [[BITCASTED_OBJ_STORAGE:%.+]] = bitcast i8* [[OBJ_STORAGE]] to %swift.opaque*

0 commit comments

Comments
 (0)