Avatar
Avatar
Yuta Saito
@swift-main -Xfrontend -emit-sil public protocol P {} public struct S1: P {} public struct S2: P {} public func makePair() -> (some P, some P) { (S1(), S1()) } (edited)
swiftNightly BOT 5/30/2022 5:20 AM
sil_stage canonical import Builtin import Swift import SwiftShims public protocol P { } public struct S1 : P { init() } public struct S2 : P { init() } public func makePair() -> (some P, some P) // main sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 { bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>): %2 = integer_literal $Builtin.Int32, 0 // user: %3 %3 = struct $Int32 (%2 : $Builtin.Int32) // user: %4 return %3 : $Int32 // id: %4 } // end sil function 'main' // S1.init() sil hidden @$s4main2S1VACycfC : $@convention(method) (@thin S1.Type) -> S1 { // %0 "$metatype" bb0(%0 : $@thin S1.Type): %1 = alloc_stack [lexical] $S1, var, name "self", implicit // user: %3 %2 = struct $S1 () // user: %4 dealloc_stack %1 : $*S1 // id: %3 return %2 : $S1 // id: %4 } // end sil function '$s4main2S1VACycfC' // makePair() sil @$s4main8makePairQr_QR_tyF : $@convention(thin) @substituted <τ_0_0, τ_0_1> () -> (@out τ_0_0, @out τ_0_1) for <@_opaqueReturnTypeOf("$s4main8makePairQr_QR_tyF", 0) __, @_opaqueReturnTypeOf("$s4main8makePairQr_QR_tyF", 1) __> { // %0 "$return_value" // user: %5 // %1 "$return_value" // user: %9 bb0(%0 : $*S1, %1 : $*S1): %2 = metatype $@thin S1.Type // user: %4 // function_ref S1.init() %3 = function_ref @$s4main2S1VACycfC : $@convention(method) (@thin S1.Type) -> S1 // user: %4 %4 = apply %3(%2) : $@convention(method) (@thin S1.Type) -> S1 // user: %5 store %4 to %0 : $*S1 // id: %5 %6 = metatype $@thin S1.Type // user: %8 // function_ref S1.init() %7 = function_ref @$s4main2S1VACycfC : $@convention(method) (@thin S1.Type) -> S1 // user: %8 %8 = apply %7(%6) : $@convention(m (edited)