Skip to content

[5.6] SIL optimizer: temporarily disable immortal arc elimination #41020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion libswift/Sources/Optimizer/PassManager/PassUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ struct PassContext {
fileprivate let passContext: BridgedPassContext

var isSwift51RuntimeAvailable: Bool {
PassContext_isSwift51RuntimeAvailable(passContext) != 0
// Temporarily disable optimizations based on deployment target.
// rdar://87898692
return false
// PassContext_isSwift51RuntimeAvailable(passContext) != 0
}

var aliasAnalysis: AliasAnalysis {
Expand Down
6 changes: 4 additions & 2 deletions test/SILOptimizer/immortal-arc-elimination.sil
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ import SwiftShims

sil_global public_external @_swiftEmptyArrayStorage : $_SwiftEmptyArrayStorage

// Check if the optimization is disbled.
// rdar://87898692

// CHECK-LABEL: sil @testEmptyArraySingleton
// CHECK: global_addr
// CHECK-NOT: retain
// CHECK: retain
// CHECK: } // end sil function 'testEmptyArraySingleton'
sil @testEmptyArraySingleton : $@convention(thin) () -> @owned Builtin.BridgeObject {
bb0:
Expand All @@ -39,7 +41,7 @@ sil_global private @staticArray : $_ContiguousArrayStorage<Int> = {

// CHECK-LABEL: sil @testGlobalValue
// CHECK: global_value
// CHECK-NOT: retain
// CHECK: retain
// CHECK: } // end sil function 'testGlobalValue'
sil @testGlobalValue : $@convention(thin) () -> @owned Builtin.BridgeObject {
bb0:
Expand Down
7 changes: 5 additions & 2 deletions test/SILOptimizer/immortal-arc-elimination.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@
// Check that the optimizer can remove "unbalanced" retains for immortal objects.
// But only with a Swift 5.1 runtime (which supports immortal objects).

// Check if the optimization is disbled.
// rdar://87898692

// CHECK-LABEL: sil hidden [noinline] @$s4test10emptyArraySaySiGyF
// CHECK: global_addr
// CHECK-NOT: retain
// CHECK: retain
// CHECK: } // end sil function '$s4test10emptyArraySaySiGyF'
@inline(never)
func emptyArray() -> [Int] {
Expand All @@ -23,7 +26,7 @@ func emptyArray() -> [Int] {

// CHECK-LABEL: sil hidden [noinline] @$s4test13constantArraySaySiGyF
// CHECK: global_value
// CHECK-NOT: retain
// CHECK: retain
// CHECK: } // end sil function '$s4test13constantArraySaySiGyF'
@inline(never)
func constantArray() -> [Int] {
Expand Down