Files
swift-mirror/test/SILOptimizer/functionsigopts_string_internal.swift
Nate Chandler 9567bd4341 [SILOptimizer] Alter FSO arg explosion heuristic.
The new rule is that an argument will be exploded if one of the
following sets of conditions hold:

(1) (a) Specializing the function will result in a thunk.  That is, the
        thunk that is generated cannot be inlined everywhere.
    (b) The argument has dead non-trivial leaves.
    (c) The argument has fewer than three live leaves.

(2) (a) Specializing the function will not result in a thunk.  That is,
        the thunk that is generated will be inlined everywhere and
        eliminated as dead code.
    (b) The argument has dead potentially trivial leaves.
    (c) The argument has fewer than six live leaves.

This change is based heavily on @gottesm's
https://github.com/apple/swift/pull/16756 .

rdar://problem/39957093
2019-09-24 15:59:28 -07:00

21 lines
926 B
Swift

// RUN: %target-swift-frontend -O -emit-sil -primary-file %s | %FileCheck %s
private var _storage: String? = nil
// CHECK-LABEL: sil hidden [noinline] @$s31functionsigopts_string_internal10setStorage2toySS_tF : $@convention(thin) (@guaranteed String) -> () {
// CHECK-LABEL: } // end sil function '$s31functionsigopts_string_internal10setStorage2toySS_tF'
@inline(never)
func setStorage(to newValue: String) {
_storage = newValue
}
// CHECK-LABEL: sil hidden @$s31functionsigopts_string_internal12setStorageToyySSF : $@convention(thin) (@guaranteed String) -> () {
// CHECK: bb{{[0-9]+}}([[STRING:%.*]] : $String):
// CHECK: [[FUNCTION:%.*]] = function_ref @$s31functionsigopts_string_internal10setStorage2toySS_tF
// CHECK: apply [[FUNCTION]]([[STRING]])
// CHECK-LABEL: } // end sil function '$s31functionsigopts_string_internal12setStorageToyySSF'
func setStorageTo(_ newValue: String) {
setStorage(to: newValue)
}