Skip to content

Instantly share code, notes, and snippets.

@PatrickPijnappel
Last active December 13, 2015 08:47
Show Gist options
  • Save PatrickPijnappel/9aa593cb6e17100ebafc to your computer and use it in GitHub Desktop.
Save PatrickPijnappel/9aa593cb6e17100ebafc to your computer and use it in GitHub Desktop.
Zip tuple expansion comparison
// Zip2.Zip2Sequence.init <A, B where A: Swift.SequenceType, B: Swift.SequenceType> (Zip2.Zip2Sequence<A, B>.Type)(A, B) -> Zip2.Zip2Sequence<A, B>
sil @_TFV4Zip212Zip2SequenceCu0_Rq_Ss12SequenceTypeq0_S1__fMGS0_q_q0__FTq_q0__GS0_q_q0__ : $@convention(thin) <Sequence1, Sequence2 where Sequence1 : SequenceType, Sequence2 : SequenceType, Sequence1.Generator : GeneratorType, Sequence2.Generator : GeneratorType> (@out Zip2Sequence<Sequence1, Sequence2>, @in Sequence1, @in Sequence2, @thin Zip2Sequence<Sequence1, Sequence2>.Type) -> () {
bb0(%0 : $*Zip2Sequence<Sequence1, Sequence2>, %1 : $*Sequence1, %2 : $*Sequence2, %3 : $@thin Zip2Sequence<Sequence1, Sequence2>.Type):
%4 = alloc_stack $Zip2Sequence<Sequence1, Sequence2> // var self // users: %7, %9, %11, %12, %14
debug_value_addr %1 : $*Sequence1 // let sequence1 // id: %5
debug_value_addr %2 : $*Sequence2 // let sequence2 // id: %6
%7 = struct_element_addr %4#1 : $*Zip2Sequence<Sequence1, Sequence2>, #Zip2Sequence._sequence1 // user: %8
copy_addr [take] %1 to [initialization] %7 : $*Sequence1 // id: %8
%9 = struct_element_addr %4#1 : $*Zip2Sequence<Sequence1, Sequence2>, #Zip2Sequence._sequence2 // user: %10
copy_addr [take] %2 to [initialization] %9 : $*Sequence2 // id: %10
copy_addr %4#1 to [initialization] %0 : $*Zip2Sequence<Sequence1, Sequence2> // id: %11
destroy_addr %4#1 : $*Zip2Sequence<Sequence1, Sequence2> // id: %12
%13 = tuple () // user: %15
dealloc_stack %4#0 : $*@local_storage Zip2Sequence<Sequence1, Sequence2> // id: %14
return %13 : $() // id: %15
}
// Zip2.Zip2Generator.init <A, B where A: Swift.GeneratorType, B: Swift.GeneratorType> (Zip2.Zip2Generator<A, B>.Type)(A, B) -> Zip2.Zip2Generator<A, B>
sil @_TFV4Zip213Zip2GeneratorCu0_Rq_Ss13GeneratorTypeq0_S1__fMGS0_q_q0__FTq_q0__GS0_q_q0__ : $@convention(thin) <Generator1, Generator2 where Generator1 : GeneratorType, Generator2 : GeneratorType> (@out Zip2Generator<Generator1, Generator2>, @in Generator1, @in Generator2, @thin Zip2Generator<Generator1, Generator2>.Type) -> () {
bb0(%0 : $*Zip2Generator<Generator1, Generator2>, %1 : $*Generator1, %2 : $*Generator2, %3 : $@thin Zip2Generator<Generator1, Generator2>.Type):
%4 = alloc_stack $Zip2Generator<Generator1, Generator2> // var self // users: %9, %11, %13, %15, %16, %18
debug_value_addr %1 : $*Generator1 // let generator1 // id: %5
debug_value_addr %2 : $*Generator2 // let generator2 // id: %6
%7 = integer_literal $Builtin.Int1, 0 // user: %8
%8 = struct $Bool (%7 : $Builtin.Int1) // user: %10
%9 = struct_element_addr %4#1 : $*Zip2Generator<Generator1, Generator2>, #Zip2Generator._reachedEnd // user: %10
store %8 to %9 : $*Bool // id: %10
%11 = struct_element_addr %4#1 : $*Zip2Generator<Generator1, Generator2>, #Zip2Generator._baseStream1 // user: %12
copy_addr [take] %1 to [initialization] %11 : $*Generator1 // id: %12
%13 = struct_element_addr %4#1 : $*Zip2Generator<Generator1, Generator2>, #Zip2Generator._baseStream2 // user: %14
copy_addr [take] %2 to [initialization] %13 : $*Generator2 // id: %14
copy_addr %4#1 to [initialization] %0 : $*Zip2Generator<Generator1, Generator2> // id: %15
destroy_addr %4#1 : $*Zip2Generator<Generator1, Generator2> // id: %16
%17 = tuple () // user: %19
dealloc_stack %4#0 : $*@local_storage Zip2Generator<Generator1, Generator2> // id: %18
return %17 : $() // id: %19
}
// Zip2.Zip2Generator.next <A, B where A: Swift.GeneratorType, B: Swift.GeneratorType> (inout Zip2.Zip2Generator<A, B>)() -> Swift.Optional<(A.Element, B.Element)>
sil @_TFV4Zip213Zip2Generator4nextu0_Rq_Ss13GeneratorTypeq0_S1__fRGS0_q_q0__FT_GSqTqq_S1_7Elementqq0_S1_7Element__ : $@convention(method) <Generator1, Generator2 where Generator1 : GeneratorType, Generator2 : GeneratorType> (@out Optional<(Generator1.Element, Generator2.Element)>, @inout Zip2Generator<Generator1, Generator2>) -> () {
bb0(%0 : $*Optional<(Generator1.Element, Generator2.Element)>, %1 : $*Zip2Generator<Generator1, Generator2>):
%2 = struct_element_addr %1 : $*Zip2Generator<Generator1, Generator2>, #Zip2Generator._reachedEnd // users: %3, %46
%3 = struct_element_addr %2 : $*Bool, #Bool.value // user: %4
%4 = load %3 : $*Builtin.Int1 // user: %5
cond_br %4, bb1, bb2 // id: %5
bb1: // Preds: bb0
inject_enum_addr %0 : $*Optional<(Generator1.Element, Generator2.Element)>, #Optional.None!enumelt // id: %6
br bb8 // id: %7
bb2: // Preds: bb0
%8 = alloc_stack $Generator1.Element // let element1 // users: %17, %25, %35, %40, %41, %43
%9 = witness_method $Generator1, #GeneratorType.next!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : GeneratorType> (@out Optional<τ_0_0.Element>, @inout τ_0_0) -> () // user: %12
%10 = struct_element_addr %1 : $*Zip2Generator<Generator1, Generator2>, #Zip2Generator._baseStream1 // user: %12
%11 = alloc_stack $Optional<Generator1.Element> // users: %12, %13, %14, %16, %18
%12 = apply %9<Generator1, Generator1.Element>(%11#1, %10) : $@convention(witness_method) <τ_0_0 where τ_0_0 : GeneratorType> (@out Optional<τ_0_0.Element>, @inout τ_0_0) -> ()
switch_enum_addr %11#1 : $*Optional<Generator1.Element>, case #Optional.Some!enumelt.1: bb4, case #Optional.None!enumelt: bb3 // id: %13
bb3: // Preds: bb2
dealloc_stack %11#0 : $*@local_storage Optional<Generator1.Element> // id: %14
br bb7 // id: %15
bb4: // Preds: bb2
%16 = unchecked_take_enum_data_addr %11#1 : $*Optional<Generator1.Element>, #Optional.Some!enumelt.1 // user: %17
copy_addr [take] %16 to [initialization] %8#1 : $*Generator1.Element // id: %17
dealloc_stack %11#0 : $*@local_storage Optional<Generator1.Element> // id: %18
%19 = alloc_stack $Generator2.Element // let element2 // users: %27, %30, %36, %38, %39
%20 = witness_method $Generator2, #GeneratorType.next!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : GeneratorType> (@out Optional<τ_0_0.Element>, @inout τ_0_0) -> () // user: %23
%21 = struct_element_addr %1 : $*Zip2Generator<Generator1, Generator2>, #Zip2Generator._baseStream2 // user: %23
%22 = alloc_stack $Optional<Generator2.Element> // users: %23, %24, %26, %29, %31
%23 = apply %20<Generator2, Generator2.Element>(%22#1, %21) : $@convention(witness_method) <τ_0_0 where τ_0_0 : GeneratorType> (@out Optional<τ_0_0.Element>, @inout τ_0_0) -> ()
switch_enum_addr %22#1 : $*Optional<Generator2.Element>, case #Optional.Some!enumelt.1: bb6, case #Optional.None!enumelt: bb5 // id: %24
bb5: // Preds: bb4
destroy_addr %8#1 : $*Generator1.Element // id: %25
dealloc_stack %22#0 : $*@local_storage Optional<Generator2.Element> // id: %26
dealloc_stack %19#0 : $*@local_storage Generator2.Element // id: %27
br bb7 // id: %28
bb6: // Preds: bb4
%29 = unchecked_take_enum_data_addr %22#1 : $*Optional<Generator2.Element>, #Optional.Some!enumelt.1 // user: %30
copy_addr [take] %29 to [initialization] %19#1 : $*Generator2.Element // id: %30
dealloc_stack %22#0 : $*@local_storage Optional<Generator2.Element> // id: %31
%32 = init_enum_data_addr %0 : $*Optional<(Generator1.Element, Generator2.Element)>, #Optional.Some!enumelt.1 // users: %33, %34
%33 = tuple_element_addr %32 : $*(Generator1.Element, Generator2.Element), 0 // user: %35
%34 = tuple_element_addr %32 : $*(Generator1.Element, Generator2.Element), 1 // user: %36
copy_addr %8#1 to [initialization] %33 : $*Generator1.Element // id: %35
copy_addr %19#1 to [initialization] %34 : $*Generator2.Element // id: %36
inject_enum_addr %0 : $*Optional<(Generator1.Element, Generator2.Element)>, #Optional.Some!enumelt.1 // id: %37
destroy_addr %19#1 : $*Generator2.Element // id: %38
dealloc_stack %19#0 : $*@local_storage Generator2.Element // id: %39
destroy_addr %8#1 : $*Generator1.Element // id: %40
dealloc_stack %8#0 : $*@local_storage Generator1.Element // id: %41
br bb8 // id: %42
bb7: // Preds: bb3 bb5
dealloc_stack %8#0 : $*@local_storage Generator1.Element // id: %43
%44 = integer_literal $Builtin.Int1, -1 // user: %45
%45 = struct $Bool (%44 : $Builtin.Int1) // user: %46
store %45 to %2 : $*Bool // id: %46
inject_enum_addr %0 : $*Optional<(Generator1.Element, Generator2.Element)>, #Optional.None!enumelt // id: %47
br bb8 // id: %48
bb8: // Preds: bb1 bb6 bb7
%49 = tuple () // user: %50
return %49 : $() // id: %50
}
// Zip2.Zip2Sequence.generate <A, B where A: Swift.SequenceType, B: Swift.SequenceType> (Zip2.Zip2Sequence<A, B>)() -> Zip2.Zip2Generator<A.Generator, B.Generator>
sil @_TFV4Zip212Zip2Sequence8generateu0_Rq_Ss12SequenceTypeq0_S1__fGS0_q_q0__FT_GVS_13Zip2Generatorqq_S1_9Generatorqq0_S1_9Generator_ : $@convention(method) <Sequence1, Sequence2 where Sequence1 : SequenceType, Sequence2 : SequenceType, Sequence1.Generator : GeneratorType, Sequence2.Generator : GeneratorType> (@out Zip2Generator<Sequence1.Generator, Sequence2.Generator>, @in_guaranteed Zip2Sequence<Sequence1, Sequence2>) -> () {
bb0(%0 : $*Zip2Generator<Sequence1.Generator, Sequence2.Generator>, %1 : $*Zip2Sequence<Sequence1, Sequence2>):
debug_value_addr %1 : $*Zip2Sequence<Sequence1, Sequence2> // let self // id: %2
// function_ref Zip2.Zip2Generator.init <A, B where A: Swift.GeneratorType, B: Swift.GeneratorType> (Zip2.Zip2Generator<A, B>.Type)(A, B) -> Zip2.Zip2Generator<A, B>
%3 = function_ref @_TFV4Zip213Zip2GeneratorCu0_Rq_Ss13GeneratorTypeq0_S1__fMGS0_q_q0__FTq_q0__GS0_q_q0__ : $@convention(thin) <τ_0_0, τ_0_1 where τ_0_0 : GeneratorType, τ_0_1 : GeneratorType> (@out Zip2Generator<τ_0_0, τ_0_1>, @in τ_0_0, @in τ_0_1, @thin Zip2Generator<τ_0_0, τ_0_1>.Type) -> () // user: %19
%4 = metatype $@thin Zip2Generator<Sequence1.Generator, Sequence2.Generator>.Type // user: %19
%5 = witness_method $Sequence1, #SequenceType.generate!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out τ_0_0.Generator, @in_guaranteed τ_0_0) -> () // user: %10
%6 = struct_element_addr %1 : $*Zip2Sequence<Sequence1, Sequence2>, #Zip2Sequence._sequence1 // user: %8
%7 = alloc_stack $Sequence1 // users: %8, %10, %11, %23
copy_addr %6 to [initialization] %7#1 : $*Sequence1 // id: %8
%9 = alloc_stack $Sequence1.Generator // users: %10, %19, %22
%10 = apply %5<Sequence1, Sequence1.Generator, Sequence1.Generator.Element, Sequence1.SubSequence>(%9#1, %7#1) : $@convention(witness_method) <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out τ_0_0.Generator, @in_guaranteed τ_0_0) -> ()
destroy_addr %7#1 : $*Sequence1 // id: %11
%12 = witness_method $Sequence2, #SequenceType.generate!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out τ_0_0.Generator, @in_guaranteed τ_0_0) -> () // user: %17
%13 = struct_element_addr %1 : $*Zip2Sequence<Sequence1, Sequence2>, #Zip2Sequence._sequence2 // user: %15
%14 = alloc_stack $Sequence2 // users: %15, %17, %18, %21
copy_addr %13 to [initialization] %14#1 : $*Sequence2 // id: %15
%16 = alloc_stack $Sequence2.Generator // users: %17, %19, %20
%17 = apply %12<Sequence2, Sequence2.Generator, Sequence2.Generator.Element, Sequence2.SubSequence>(%16#1, %14#1) : $@convention(witness_method) <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out τ_0_0.Generator, @in_guaranteed τ_0_0) -> ()
destroy_addr %14#1 : $*Sequence2 // id: %18
%19 = apply %3<Sequence1.Generator, Sequence2.Generator, Sequence1.Generator.Element, Sequence2.Generator.Element>(%0, %9#1, %16#1, %4) : $@convention(thin) <τ_0_0, τ_0_1 where τ_0_0 : GeneratorType, τ_0_1 : GeneratorType> (@out Zip2Generator<τ_0_0, τ_0_1>, @in τ_0_0, @in τ_0_1, @thin Zip2Generator<τ_0_0, τ_0_1>.Type) -> ()
dealloc_stack %16#0 : $*@local_storage Sequence2.Generator // id: %20
dealloc_stack %14#0 : $*@local_storage Sequence2 // id: %21
dealloc_stack %9#0 : $*@local_storage Sequence1.Generator // id: %22
dealloc_stack %7#0 : $*@local_storage Sequence1 // id: %23
%24 = tuple () // user: %25
return %24 : $() // id: %25
}
// Zip1.Zip2Sequence.init <A, B where A: Swift.SequenceType, B: Swift.SequenceType> (Zip1.Zip2Sequence<A, B>.Type)(A, B) -> Zip1.Zip2Sequence<A, B>
sil @_TFV4Zip112Zip2SequenceCu0_Rq_Ss12SequenceTypeq0_S1__fMGS0_q_q0__FTq_q0__GS0_q_q0__ : $@convention(thin) <Sequence1, Sequence2 where Sequence1 : SequenceType, Sequence2 : SequenceType, Sequence1.Generator : GeneratorType, Sequence2.Generator : GeneratorType> (@out Zip2Sequence<Sequence1, Sequence2>, @in Sequence1, @in Sequence2, @thin Zip2Sequence<Sequence1, Sequence2>.Type) -> () {
bb0(%0 : $*Zip2Sequence<Sequence1, Sequence2>, %1 : $*Sequence1, %2 : $*Sequence2, %3 : $@thin Zip2Sequence<Sequence1, Sequence2>.Type):
%4 = alloc_stack $Zip2Sequence<Sequence1, Sequence2> // var self // users: %7, %12, %13, %15
debug_value_addr %1 : $*Sequence1 // let sequence1 // id: %5
debug_value_addr %2 : $*Sequence2 // let sequence2 // id: %6
%7 = struct_element_addr %4#1 : $*Zip2Sequence<Sequence1, Sequence2>, #Zip2Sequence._sequences // users: %8, %9
%8 = tuple_element_addr %7 : $*(Sequence1, Sequence2), 0 // user: %10
%9 = tuple_element_addr %7 : $*(Sequence1, Sequence2), 1 // user: %11
copy_addr [take] %1 to [initialization] %8 : $*Sequence1 // id: %10
copy_addr [take] %2 to [initialization] %9 : $*Sequence2 // id: %11
copy_addr %4#1 to [initialization] %0 : $*Zip2Sequence<Sequence1, Sequence2> // id: %12
destroy_addr %4#1 : $*Zip2Sequence<Sequence1, Sequence2> // id: %13
%14 = tuple () // user: %16
dealloc_stack %4#0 : $*@local_storage Zip2Sequence<Sequence1, Sequence2> // id: %15
return %14 : $() // id: %16
}
// Zip1.Zip2Generator.init <A, B where A: Swift.GeneratorType, B: Swift.GeneratorType> (Zip1.Zip2Generator<A, B>.Type)(A, B) -> Zip1.Zip2Generator<A, B>
sil @_TFV4Zip113Zip2GeneratorCu0_Rq_Ss13GeneratorTypeq0_S1__fMGS0_q_q0__FTq_q0__GS0_q_q0__ : $@convention(thin) <Generator1, Generator2 where Generator1 : GeneratorType, Generator2 : GeneratorType> (@out Zip2Generator<Generator1, Generator2>, @in Generator1, @in Generator2, @thin Zip2Generator<Generator1, Generator2>.Type) -> () {
bb0(%0 : $*Zip2Generator<Generator1, Generator2>, %1 : $*Generator1, %2 : $*Generator2, %3 : $@thin Zip2Generator<Generator1, Generator2>.Type):
%4 = alloc_stack $Zip2Generator<Generator1, Generator2> // var self // users: %9, %11, %16, %17, %19
debug_value_addr %1 : $*Generator1 // let generator1 // id: %5
debug_value_addr %2 : $*Generator2 // let generator2 // id: %6
%7 = integer_literal $Builtin.Int1, 0 // user: %8
%8 = struct $Bool (%7 : $Builtin.Int1) // user: %10
%9 = struct_element_addr %4#1 : $*Zip2Generator<Generator1, Generator2>, #Zip2Generator._reachedEnd // user: %10
store %8 to %9 : $*Bool // id: %10
%11 = struct_element_addr %4#1 : $*Zip2Generator<Generator1, Generator2>, #Zip2Generator._baseStreams // users: %12, %13
%12 = tuple_element_addr %11 : $*(Generator1, Generator2), 0 // user: %14
%13 = tuple_element_addr %11 : $*(Generator1, Generator2), 1 // user: %15
copy_addr [take] %1 to [initialization] %12 : $*Generator1 // id: %14
copy_addr [take] %2 to [initialization] %13 : $*Generator2 // id: %15
copy_addr %4#1 to [initialization] %0 : $*Zip2Generator<Generator1, Generator2> // id: %16
destroy_addr %4#1 : $*Zip2Generator<Generator1, Generator2> // id: %17
%18 = tuple () // user: %20
dealloc_stack %4#0 : $*@local_storage Zip2Generator<Generator1, Generator2> // id: %19
return %18 : $() // id: %20
}
// Zip1.Zip2Generator.next <A, B where A: Swift.GeneratorType, B: Swift.GeneratorType> (inout Zip1.Zip2Generator<A, B>)() -> Swift.Optional<(A.Element, B.Element)>
sil @_TFV4Zip113Zip2Generator4nextu0_Rq_Ss13GeneratorTypeq0_S1__fRGS0_q_q0__FT_GSqTqq_S1_7Elementqq0_S1_7Element__ : $@convention(method) <Generator1, Generator2 where Generator1 : GeneratorType, Generator2 : GeneratorType> (@out Optional<(Generator1.Element, Generator2.Element)>, @inout Zip2Generator<Generator1, Generator2>) -> () {
bb0(%0 : $*Optional<(Generator1.Element, Generator2.Element)>, %1 : $*Zip2Generator<Generator1, Generator2>):
%2 = struct_element_addr %1 : $*Zip2Generator<Generator1, Generator2>, #Zip2Generator._reachedEnd // users: %3, %47
%3 = struct_element_addr %2 : $*Bool, #Bool.value // user: %4
%4 = load %3 : $*Builtin.Int1 // user: %5
cond_br %4, bb1, bb2 // id: %5
bb1: // Preds: bb0
inject_enum_addr %0 : $*Optional<(Generator1.Element, Generator2.Element)>, #Optional.None!enumelt // id: %6
br bb8 // id: %7
bb2: // Preds: bb0
%8 = alloc_stack $Generator1.Element // let element0 // users: %18, %26, %36, %41, %42, %44
%9 = witness_method $Generator1, #GeneratorType.next!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : GeneratorType> (@out Optional<τ_0_0.Element>, @inout τ_0_0) -> () // user: %13
%10 = struct_element_addr %1 : $*Zip2Generator<Generator1, Generator2>, #Zip2Generator._baseStreams // users: %11, %22
%11 = tuple_element_addr %10 : $*(Generator1, Generator2), 0 // user: %13
%12 = alloc_stack $Optional<Generator1.Element> // users: %13, %14, %15, %17, %19
%13 = apply %9<Generator1, Generator1.Element>(%12#1, %11) : $@convention(witness_method) <τ_0_0 where τ_0_0 : GeneratorType> (@out Optional<τ_0_0.Element>, @inout τ_0_0) -> ()
switch_enum_addr %12#1 : $*Optional<Generator1.Element>, case #Optional.Some!enumelt.1: bb4, case #Optional.None!enumelt: bb3 // id: %14
bb3: // Preds: bb2
dealloc_stack %12#0 : $*@local_storage Optional<Generator1.Element> // id: %15
br bb7 // id: %16
bb4: // Preds: bb2
%17 = unchecked_take_enum_data_addr %12#1 : $*Optional<Generator1.Element>, #Optional.Some!enumelt.1 // user: %18
copy_addr [take] %17 to [initialization] %8#1 : $*Generator1.Element // id: %18
dealloc_stack %12#0 : $*@local_storage Optional<Generator1.Element> // id: %19
%20 = alloc_stack $Generator2.Element // let element1 // users: %28, %31, %37, %39, %40
%21 = witness_method $Generator2, #GeneratorType.next!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : GeneratorType> (@out Optional<τ_0_0.Element>, @inout τ_0_0) -> () // user: %24
%22 = tuple_element_addr %10 : $*(Generator1, Generator2), 1 // user: %24
%23 = alloc_stack $Optional<Generator2.Element> // users: %24, %25, %27, %30, %32
%24 = apply %21<Generator2, Generator2.Element>(%23#1, %22) : $@convention(witness_method) <τ_0_0 where τ_0_0 : GeneratorType> (@out Optional<τ_0_0.Element>, @inout τ_0_0) -> ()
switch_enum_addr %23#1 : $*Optional<Generator2.Element>, case #Optional.Some!enumelt.1: bb6, case #Optional.None!enumelt: bb5 // id: %25
bb5: // Preds: bb4
destroy_addr %8#1 : $*Generator1.Element // id: %26
dealloc_stack %23#0 : $*@local_storage Optional<Generator2.Element> // id: %27
dealloc_stack %20#0 : $*@local_storage Generator2.Element // id: %28
br bb7 // id: %29
bb6: // Preds: bb4
%30 = unchecked_take_enum_data_addr %23#1 : $*Optional<Generator2.Element>, #Optional.Some!enumelt.1 // user: %31
copy_addr [take] %30 to [initialization] %20#1 : $*Generator2.Element // id: %31
dealloc_stack %23#0 : $*@local_storage Optional<Generator2.Element> // id: %32
%33 = init_enum_data_addr %0 : $*Optional<(Generator1.Element, Generator2.Element)>, #Optional.Some!enumelt.1 // users: %34, %35
%34 = tuple_element_addr %33 : $*(Generator1.Element, Generator2.Element), 0 // user: %36
%35 = tuple_element_addr %33 : $*(Generator1.Element, Generator2.Element), 1 // user: %37
copy_addr %8#1 to [initialization] %34 : $*Generator1.Element // id: %36
copy_addr %20#1 to [initialization] %35 : $*Generator2.Element // id: %37
inject_enum_addr %0 : $*Optional<(Generator1.Element, Generator2.Element)>, #Optional.Some!enumelt.1 // id: %38
destroy_addr %20#1 : $*Generator2.Element // id: %39
dealloc_stack %20#0 : $*@local_storage Generator2.Element // id: %40
destroy_addr %8#1 : $*Generator1.Element // id: %41
dealloc_stack %8#0 : $*@local_storage Generator1.Element // id: %42
br bb8 // id: %43
bb7: // Preds: bb3 bb5
dealloc_stack %8#0 : $*@local_storage Generator1.Element // id: %44
%45 = integer_literal $Builtin.Int1, -1 // user: %46
%46 = struct $Bool (%45 : $Builtin.Int1) // user: %47
store %46 to %2 : $*Bool // id: %47
inject_enum_addr %0 : $*Optional<(Generator1.Element, Generator2.Element)>, #Optional.None!enumelt // id: %48
br bb8 // id: %49
bb8: // Preds: bb1 bb6 bb7
%50 = tuple () // user: %51
return %50 : $() // id: %51
}
// Zip1.Zip2Sequence.generate <A, B where A: Swift.SequenceType, B: Swift.SequenceType> (Zip1.Zip2Sequence<A, B>)() -> Zip1.Zip2Generator<A.Generator, B.Generator>
sil @_TFV4Zip112Zip2Sequence8generateu0_Rq_Ss12SequenceTypeq0_S1__fGS0_q_q0__FT_GVS_13Zip2Generatorqq_S1_9Generatorqq0_S1_9Generator_ : $@convention(method) <Sequence1, Sequence2 where Sequence1 : SequenceType, Sequence2 : SequenceType, Sequence1.Generator : GeneratorType, Sequence2.Generator : GeneratorType> (@out Zip2Generator<Sequence1.Generator, Sequence2.Generator>, @in_guaranteed Zip2Sequence<Sequence1, Sequence2>) -> () {
bb0(%0 : $*Zip2Generator<Sequence1.Generator, Sequence2.Generator>, %1 : $*Zip2Sequence<Sequence1, Sequence2>):
debug_value_addr %1 : $*Zip2Sequence<Sequence1, Sequence2> // let self // id: %2
// function_ref Zip1.Zip2Generator.init <A, B where A: Swift.GeneratorType, B: Swift.GeneratorType> (Zip1.Zip2Generator<A, B>.Type)(A, B) -> Zip1.Zip2Generator<A, B>
%3 = function_ref @_TFV4Zip113Zip2GeneratorCu0_Rq_Ss13GeneratorTypeq0_S1__fMGS0_q_q0__FTq_q0__GS0_q_q0__ : $@convention(thin) <τ_0_0, τ_0_1 where τ_0_0 : GeneratorType, τ_0_1 : GeneratorType> (@out Zip2Generator<τ_0_0, τ_0_1>, @in τ_0_0, @in τ_0_1, @thin Zip2Generator<τ_0_0, τ_0_1>.Type) -> () // user: %20
%4 = metatype $@thin Zip2Generator<Sequence1.Generator, Sequence2.Generator>.Type // user: %20
%5 = witness_method $Sequence1, #SequenceType.generate!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out τ_0_0.Generator, @in_guaranteed τ_0_0) -> () // user: %12
%6 = struct_element_addr %1 : $*Zip2Sequence<Sequence1, Sequence2>, #Zip2Sequence._sequences // users: %8, %9
%7 = alloc_stack $Sequence1 // users: %10, %12, %13, %24
%8 = tuple_element_addr %6 : $*(Sequence1, Sequence2), 0 // user: %10
%9 = tuple_element_addr %6 : $*(Sequence1, Sequence2), 1 // user: %16
copy_addr %8 to [initialization] %7#1 : $*Sequence1 // id: %10
%11 = alloc_stack $Sequence1.Generator // users: %12, %20, %23
%12 = apply %5<Sequence1, Sequence1.Generator, Sequence1.Generator.Element, Sequence1.SubSequence>(%11#1, %7#1) : $@convention(witness_method) <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out τ_0_0.Generator, @in_guaranteed τ_0_0) -> ()
destroy_addr %7#1 : $*Sequence1 // id: %13
%14 = witness_method $Sequence2, #SequenceType.generate!1 : $@convention(witness_method) <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out τ_0_0.Generator, @in_guaranteed τ_0_0) -> () // user: %18
%15 = alloc_stack $Sequence2 // users: %16, %18, %19, %22
copy_addr %9 to [initialization] %15#1 : $*Sequence2 // id: %16
%17 = alloc_stack $Sequence2.Generator // users: %18, %20, %21
%18 = apply %14<Sequence2, Sequence2.Generator, Sequence2.Generator.Element, Sequence2.SubSequence>(%17#1, %15#1) : $@convention(witness_method) <τ_0_0 where τ_0_0 : SequenceType, τ_0_0.Generator : GeneratorType> (@out τ_0_0.Generator, @in_guaranteed τ_0_0) -> ()
destroy_addr %15#1 : $*Sequence2 // id: %19
%20 = apply %3<Sequence1.Generator, Sequence2.Generator, Sequence1.Generator.Element, Sequence2.Generator.Element>(%0, %11#1, %17#1, %4) : $@convention(thin) <τ_0_0, τ_0_1 where τ_0_0 : GeneratorType, τ_0_1 : GeneratorType> (@out Zip2Generator<τ_0_0, τ_0_1>, @in τ_0_0, @in τ_0_1, @thin Zip2Generator<τ_0_0, τ_0_1>.Type) -> ()
dealloc_stack %17#0 : $*@local_storage Sequence2.Generator // id: %21
dealloc_stack %15#0 : $*@local_storage Sequence2 // id: %22
dealloc_stack %11#0 : $*@local_storage Sequence1.Generator // id: %23
dealloc_stack %7#0 : $*@local_storage Sequence1 // id: %24
%25 = tuple () // user: %26
return %25 : $() // id: %26
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment