Skip to content

Commit 17dc994

Browse files
authored
Merge pull request #41020 from eeckstein/disable-immortal-arc-elimination
[5.6] SIL optimizer: temporarily disable immortal arc elimination
2 parents cf27f49 + c589c05 commit 17dc994

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

libswift/Sources/Optimizer/PassManager/PassUtils.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ struct PassContext {
2323
fileprivate let passContext: BridgedPassContext
2424

2525
var isSwift51RuntimeAvailable: Bool {
26-
PassContext_isSwift51RuntimeAvailable(passContext) != 0
26+
// Temporarily disable optimizations based on deployment target.
27+
// rdar://87898692
28+
return false
29+
// PassContext_isSwift51RuntimeAvailable(passContext) != 0
2730
}
2831

2932
var aliasAnalysis: AliasAnalysis {

test/SILOptimizer/immortal-arc-elimination.sil

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ import SwiftShims
1212

1313
sil_global public_external @_swiftEmptyArrayStorage : $_SwiftEmptyArrayStorage
1414

15+
// Check if the optimization is disbled.
16+
// rdar://87898692
1517

1618
// CHECK-LABEL: sil @testEmptyArraySingleton
1719
// CHECK: global_addr
18-
// CHECK-NOT: retain
20+
// CHECK: retain
1921
// CHECK: } // end sil function 'testEmptyArraySingleton'
2022
sil @testEmptyArraySingleton : $@convention(thin) () -> @owned Builtin.BridgeObject {
2123
bb0:
@@ -39,7 +41,7 @@ sil_global private @staticArray : $_ContiguousArrayStorage<Int> = {
3941

4042
// CHECK-LABEL: sil @testGlobalValue
4143
// CHECK: global_value
42-
// CHECK-NOT: retain
44+
// CHECK: retain
4345
// CHECK: } // end sil function 'testGlobalValue'
4446
sil @testGlobalValue : $@convention(thin) () -> @owned Builtin.BridgeObject {
4547
bb0:

test/SILOptimizer/immortal-arc-elimination.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@
1111
// Check that the optimizer can remove "unbalanced" retains for immortal objects.
1212
// But only with a Swift 5.1 runtime (which supports immortal objects).
1313

14+
// Check if the optimization is disbled.
15+
// rdar://87898692
16+
1417
// CHECK-LABEL: sil hidden [noinline] @$s4test10emptyArraySaySiGyF
1518
// CHECK: global_addr
16-
// CHECK-NOT: retain
19+
// CHECK: retain
1720
// CHECK: } // end sil function '$s4test10emptyArraySaySiGyF'
1821
@inline(never)
1922
func emptyArray() -> [Int] {
@@ -23,7 +26,7 @@ func emptyArray() -> [Int] {
2326

2427
// CHECK-LABEL: sil hidden [noinline] @$s4test13constantArraySaySiGyF
2528
// CHECK: global_value
26-
// CHECK-NOT: retain
29+
// CHECK: retain
2730
// CHECK: } // end sil function '$s4test13constantArraySaySiGyF'
2831
@inline(never)
2932
func constantArray() -> [Int] {

0 commit comments

Comments
 (0)