Skip to content

Commit 4a657d5

Browse files
committed
[SILOpt] Run DestroyAddrHoisting in mandatory.
Run DestroyAddrHoisting in the pipeline where DestroyHoisting was previously running. Avoid extra ARC traffic that having no form of destroy hoisting in the mandatory pipeline results in. rdar://90495704
1 parent d9b7ddc commit 4a657d5

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,12 @@ static void addMandatoryDiagnosticOptPipeline(SILPassPipelinePlan &P) {
176176
P.addSILSkippingChecker();
177177
#endif
178178

179-
if (Options.shouldOptimize() && EnableDestroyHoisting) {
180-
P.addDestroyHoisting();
179+
if (Options.shouldOptimize()) {
180+
if (EnableDestroyHoisting) {
181+
P.addDestroyHoisting();
182+
} else if (P.getOptions().DestroyHoisting == DestroyHoistingOption::On) {
183+
P.addDestroyAddrHoisting();
184+
}
181185
}
182186
P.addMandatoryInlining();
183187
P.addMandatorySILLinker();

test/SILOptimizer/capture_promotion_generic_context.sil

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,10 @@ exit:
108108
// closure is invoked.
109109
// CHECK-LABEL: sil {{.*}}@call_generic_promotable_box_from_different_generic2 :
110110
// CHECK: bb0(%0 : $*R<T>, %1 : $*E<(R<U>) -> Builtin.Int32>, %2 : $*Builtin.Int32):
111-
// CHECK: %3 = load %1 : $*E<(R<U>) -> Builtin.Int32>
112111
// CHECK: [[F:%.*]] = function_ref @$s23generic_promotable_box2Tf2nnni_n : $@convention(thin) <τ_0_0> (@in_guaranteed R<τ_0_0>, @in_guaranteed Builtin.Int32, @guaranteed E<(R<τ_0_0>) -> Builtin.Int32>) -> @out Builtin.Int32
113-
// CHECK-NEXT: [[CLOSURE:%.*]] = partial_apply [callee_guaranteed] [[F]]<U>(%2, %3)
114-
// CHECK-NEXT: retain_value %3
112+
// CHECK: %4 = load %1 : $*E<(R<U>) -> Builtin.Int32>
113+
// CHECK-NEXT: [[CLOSURE:%.*]] = partial_apply [callee_guaranteed] [[F]]<U>(%2, %4)
114+
// CHECK-NEXT: retain_value %4
115115
// CHECK-NEXT: return [[CLOSURE]]
116116
// CHECK: } // end sil function 'call_generic_promotable_box_from_different_generic2'
117117
sil [ossa] @call_generic_promotable_box_from_different_generic2 : $@convention(thin) <T, U: P> (@in_guaranteed R<T>, @in_guaranteed E<(R<U>)->Int>, @in Int) -> @owned @callee_guaranteed (@in_guaranteed R<U>) -> @out Int {

test/SILOptimizer/performance-annotations.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ struct AllocatingStr : P {
3131
}
3232
}
3333

34-
/* Currently disabled: rdar://90495704
35-
3634
func noRTCallsForArrayGet(_ a: [Str], _ i: Int) -> Int {
3735
return a[i].x
3836
}
@@ -41,7 +39,6 @@ func noRTCallsForArrayGet(_ a: [Str], _ i: Int) -> Int {
4139
func callArrayGet(_ a: [Str]) -> Int {
4240
return noRTCallsForArrayGet(a, 0)
4341
}
44-
*/
4542

4643
@_noLocks
4744
func arcOperations(_ x: Cl) -> Cl {

0 commit comments

Comments
 (0)