Skip to content

Instantly share code, notes, and snippets.

@geoffreywiseman
Last active December 27, 2016 16:27
Show Gist options
  • Save geoffreywiseman/366a7ef8dafda0217c191977faa19b17 to your computer and use it in GitHub Desktop.
Save geoffreywiseman/366a7ef8dafda0217c191977faa19b17 to your computer and use it in GitHub Desktop.
Comparing lazy to "industrious" properties at the SIL level.
sil_stage canonical
import Builtin
import Swift
import SwiftShims
// static CommandLine._argc
sil_global [fragile] @_TZvOs11CommandLine5_argcVs5Int32 : $Int32
// globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4
sil_global private_external [fragile] @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4 : $Builtin.Word
// static CommandLine._unsafeArgv
sil_global [fragile] @_TZvOs11CommandLine11_unsafeArgvGSpGSqGSpVs4Int8___ : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>
sil_scope 1 { parent @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 }
// main
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
// %0 // user: %3
// %1 // user: %9
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
%2 = global_addr @_TZvOs11CommandLine5_argcVs5Int32 : $*Int32, scope 1 // user: %3
store %0 to %2 : $*Int32, scope 1 // id: %3
%4 = global_addr @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4 : $*Builtin.Word, scope 1 // user: %5
%5 = address_to_pointer %4 : $*Builtin.Word to $Builtin.RawPointer, scope 1 // user: %7
// function_ref globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4
%6 = function_ref @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4 : $@convention(thin) () -> (), scope 1 // user: %7
%7 = builtin "once"(%5 : $Builtin.RawPointer, %6 : $@convention(thin) () -> ()) : $(), scope 1
%8 = global_addr @_TZvOs11CommandLine11_unsafeArgvGSpGSqGSpVs4Int8___ : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 1 // user: %9
store %1 to %8 : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 1 // id: %9
%10 = tuple (), scope 1
%11 = integer_literal $Builtin.Int32, 0, scope 1 // user: %12
%12 = struct $Int32 (%11 : $Builtin.Int32), scope 1 // user: %13
return %12 : $Int32, scope 1 // id: %13
}
sil_scope 2 { parent @_TFs20_stdlib_didEnterMainFT4argcVs5Int324argvGSpGSqGSpVs4Int8____T_ : $@convention(thin) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> () }
// _stdlib_didEnterMain(argc : Int32, argv : UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>) -> ()
sil public_external [transparent] [fragile] @_TFs20_stdlib_didEnterMainFT4argcVs5Int324argvGSpGSqGSpVs4Int8____T_ : $@convention(thin) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> () {
// %0 // users: %5, %2
// %1 // users: %11, %3
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
debug_value %0 : $Int32, scope 2 // id: %2
debug_value %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 2 // id: %3
%4 = global_addr @_TZvOs11CommandLine5_argcVs5Int32 : $*Int32, scope 2 // user: %5
store %0 to %4 : $*Int32, scope 2 // id: %5
%6 = global_addr @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4 : $*Builtin.Word, scope 2 // user: %7
%7 = address_to_pointer %6 : $*Builtin.Word to $Builtin.RawPointer, scope 2 // user: %9
// function_ref globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4
%8 = function_ref @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4 : $@convention(thin) () -> (), scope 2 // user: %9
%9 = builtin "once"(%7 : $Builtin.RawPointer, %8 : $@convention(thin) () -> ()) : $(), scope 2
%10 = global_addr @_TZvOs11CommandLine11_unsafeArgvGSpGSqGSpVs4Int8___ : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 2 // user: %11
store %1 to %10 : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 2 // id: %11
%12 = tuple (), scope 2 // user: %13
return %12 : $(), scope 2 // id: %13
}
sil_scope 3 { loc "example-industrious-one.swift":1:7 parent @_TFC4main9ContainerD : $@convention(method) (@owned Container) -> () }
// Container.__deallocating_deinit
sil hidden @_TFC4main9ContainerD : $@convention(method) (@owned Container) -> () {
// %0 // users: %3, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-industrious-one.swift":1:7, scope 3 // id: %1
// function_ref Container.deinit
%2 = function_ref @_TFC4main9Containerd : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject, scope 3 // user: %3
%3 = apply %2(%0) : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject, scope 3 // user: %4
%4 = unchecked_ref_cast %3 : $Builtin.NativeObject to $Container, scope 3 // user: %5
dealloc_ref %4 : $Container, scope 3 // id: %5
%6 = tuple (), scope 3 // user: %7
return %6 : $(), scope 3 // id: %7
}
sil_scope 4 { loc "example-industrious-one.swift":1:7 parent @_TFC4main9Containerd : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject }
sil_scope 5 { loc "example-industrious-one.swift":1:7 parent 4 }
// Container.deinit
sil hidden @_TFC4main9Containerd : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject {
// %0 // users: %2, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-industrious-one.swift":1:7, scope 4 // id: %1
%2 = unchecked_ref_cast %0 : $Container to $Builtin.NativeObject, scope 5 // user: %3
return %2 : $Builtin.NativeObject, scope 5 // id: %3
}
sil_scope 6 { loc "example-industrious-one.swift":2:7 parent @_TFC4main9Containerg9containedSi : $@convention(method) (@guaranteed Container) -> Int }
sil_scope 7 { loc "example-industrious-one.swift":2:7 parent 6 }
// Container.contained.getter
sil hidden [transparent] @_TFC4main9Containerg9containedSi : $@convention(method) (@guaranteed Container) -> Int {
// %0 // users: %2, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-industrious-one.swift":2:7, scope 6 // id: %1
%2 = ref_element_addr %0 : $Container, #Container.contained, scope 7 // user: %3
%3 = load %2 : $*Int, scope 7 // user: %4
return %3 : $Int, loc "example-industrious-one.swift":2:7, scope 7 // id: %4
}
sil_scope 8 { loc "example-industrious-one.swift":2:7 parent @_TFC4main9Containers9containedSi : $@convention(method) (Int, @guaranteed Container) -> () }
sil_scope 9 { loc "example-industrious-one.swift":2:7 parent 8 }
// Container.contained.setter
sil hidden [transparent] @_TFC4main9Containers9containedSi : $@convention(method) (Int, @guaranteed Container) -> () {
// %0 // users: %5, %2
// %1 // users: %4, %3
bb0(%0 : $Int, %1 : $Container):
debug_value %0 : $Int, let, name "value", argno 1, loc "example-industrious-one.swift":2:7, scope 8 // id: %2
debug_value %1 : $Container, let, name "self", argno 2, loc "example-industrious-one.swift":2:7, scope 8 // id: %3
%4 = ref_element_addr %1 : $Container, #Container.contained, scope 9 // user: %5
store %0 to %4 : $*Int, scope 9 // id: %5
%6 = tuple (), loc "example-industrious-one.swift":2:7, scope 9 // user: %7
return %6 : $(), loc "example-industrious-one.swift":2:7, scope 9 // id: %7
}
sil_scope 10 { loc "example-industrious-one.swift":2:7 parent @_TFC4main9Containerm9containedSi : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Container) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) }
// Container.contained.materializeForSet
sil hidden [transparent] @_TFC4main9Containerm9containedSi : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Container) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
// %2 // user: %3
bb0(%0 : $Builtin.RawPointer, %1 : $*Builtin.UnsafeValueBuffer, %2 : $Container):
%3 = ref_element_addr %2 : $Container, #Container.contained, scope 10 // user: %4
%4 = address_to_pointer %3 : $*Int to $Builtin.RawPointer, scope 10 // user: %6
%5 = enum $Optional<Builtin.RawPointer>, #Optional.none!enumelt, scope 10 // user: %6
%6 = tuple (%4 : $Builtin.RawPointer, %5 : $Optional<Builtin.RawPointer>), scope 10 // user: %7
return %6 : $(Builtin.RawPointer, Optional<Builtin.RawPointer>), scope 10 // id: %7
}
sil_scope 11 { loc "example-industrious-one.swift":1:7 parent @_TFC4main9ContainercfT_S0_ : $@convention(method) (@owned Container) -> @owned Container }
sil_scope 12 { parent 11 }
// Container.init() -> Container
sil hidden @_TFC4main9ContainercfT_S0_ : $@convention(method) (@owned Container) -> @owned Container {
// %0 // users: %4, %6, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", loc "example-industrious-one.swift":1:7, scope 11 // id: %1
%2 = integer_literal $Builtin.Int64, 0, loc "example-industrious-one.swift":2:24, scope 11 // user: %3
%3 = struct $Int (%2 : $Builtin.Int64), loc "example-industrious-one.swift":2:24, scope 11 // user: %5
%4 = ref_element_addr %0 : $Container, #Container.contained, loc "example-industrious-one.swift":2:7, scope 11 // user: %5
store %3 to %4 : $*Int, loc "example-industrious-one.swift":2:7, scope 11 // id: %5
return %0 : $Container, loc "example-industrious-one.swift":1:7, scope 12 // id: %6
}
sil_scope 13 { loc "example-industrious-one.swift":1:7 parent @_TFC4main9ContainerCfT_S0_ : $@convention(method) (@thick Container.Type) -> @owned Container }
// Container.__allocating_init() -> Container
sil hidden @_TFC4main9ContainerCfT_S0_ : $@convention(method) (@thick Container.Type) -> @owned Container {
bb0(%0 : $@thick Container.Type):
%1 = alloc_ref $Container, scope 13 // user: %3
// function_ref Container.init() -> Container
%2 = function_ref @_TFC4main9ContainercfT_S0_ : $@convention(method) (@owned Container) -> @owned Container, scope 13 // user: %3
%3 = apply %2(%1) : $@convention(method) (@owned Container) -> @owned Container, scope 13 // user: %4
return %3 : $Container, scope 13 // id: %4
}
sil_scope 14 { parent @_TFSiCfT22_builtinIntegerLiteralBi2048__Si : $@convention(method) (Builtin.Int2048, @thin Int.Type) -> Int }
// Int.init(_builtinIntegerLiteral : Builtin.Int2048) -> Int
sil public_external [transparent] [fragile] @_TFSiCfT22_builtinIntegerLiteralBi2048__Si : $@convention(method) (Builtin.Int2048, @thin Int.Type) -> Int {
// %0 // users: %3, %2
bb0(%0 : $Builtin.Int2048, %1 : $@thin Int.Type):
debug_value %0 : $Builtin.Int2048, scope 14 // id: %2
%3 = builtin "s_to_s_checked_trunc_Int2048_Int64"(%0 : $Builtin.Int2048) : $(Builtin.Int64, Builtin.Int1), scope 14 // user: %4
%4 = tuple_extract %3 : $(Builtin.Int64, Builtin.Int1), 0, scope 14 // user: %5
%5 = struct $Int (%4 : $Builtin.Int64), scope 14 // user: %6
return %5 : $Int, scope 14 // id: %6
}
// globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4
sil private_external [fragile] @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4 : $@convention(thin) () -> ()
sil_vtable Container {
#Container.deinit!deallocator: _TFC4main9ContainerD // Container.__deallocating_deinit
#Container.contained!getter.1: _TFC4main9Containerg9containedSi // Container.contained.getter
#Container.contained!setter.1: _TFC4main9Containers9containedSi // Container.contained.setter
#Container.contained!materializeForSet.1: _TFC4main9Containerm9containedSi // Container.contained.materializeForSet
#Container.init!initializer.1: _TFC4main9ContainercfT_S0_ // Container.init() -> Container
}
class Container {
var contained: Int = 0
}
sil_stage canonical
import Builtin
import Swift
import SwiftShims
// static CommandLine._argc
sil_global [fragile] @_TZvOs11CommandLine5_argcVs5Int32 : $Int32
// globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4
sil_global private_external [fragile] @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4 : $Builtin.Word
// static CommandLine._unsafeArgv
sil_global [fragile] @_TZvOs11CommandLine11_unsafeArgvGSpGSqGSpVs4Int8___ : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>
sil_scope 1 { parent @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 }
// main
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
// %0 // user: %3
// %1 // user: %9
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
%2 = global_addr @_TZvOs11CommandLine5_argcVs5Int32 : $*Int32, scope 1 // user: %3
store %0 to %2 : $*Int32, scope 1 // id: %3
%4 = global_addr @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4 : $*Builtin.Word, scope 1 // user: %5
%5 = address_to_pointer %4 : $*Builtin.Word to $Builtin.RawPointer, scope 1 // user: %7
// function_ref globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4
%6 = function_ref @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4 : $@convention(thin) () -> (), scope 1 // user: %7
%7 = builtin "once"(%5 : $Builtin.RawPointer, %6 : $@convention(thin) () -> ()) : $(), scope 1
%8 = global_addr @_TZvOs11CommandLine11_unsafeArgvGSpGSqGSpVs4Int8___ : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 1 // user: %9
store %1 to %8 : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 1 // id: %9
%10 = tuple (), scope 1
%11 = integer_literal $Builtin.Int32, 0, scope 1 // user: %12
%12 = struct $Int32 (%11 : $Builtin.Int32), scope 1 // user: %13
return %12 : $Int32, scope 1 // id: %13
}
sil_scope 2 { parent @_TFs20_stdlib_didEnterMainFT4argcVs5Int324argvGSpGSqGSpVs4Int8____T_ : $@convention(thin) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> () }
// _stdlib_didEnterMain(argc : Int32, argv : UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>) -> ()
sil public_external [transparent] [fragile] @_TFs20_stdlib_didEnterMainFT4argcVs5Int324argvGSpGSqGSpVs4Int8____T_ : $@convention(thin) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> () {
// %0 // users: %5, %2
// %1 // users: %11, %3
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
debug_value %0 : $Int32, scope 2 // id: %2
debug_value %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 2 // id: %3
%4 = global_addr @_TZvOs11CommandLine5_argcVs5Int32 : $*Int32, scope 2 // user: %5
store %0 to %4 : $*Int32, scope 2 // id: %5
%6 = global_addr @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4 : $*Builtin.Word, scope 2 // user: %7
%7 = address_to_pointer %6 : $*Builtin.Word to $Builtin.RawPointer, scope 2 // user: %9
// function_ref globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4
%8 = function_ref @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4 : $@convention(thin) () -> (), scope 2 // user: %9
%9 = builtin "once"(%7 : $Builtin.RawPointer, %8 : $@convention(thin) () -> ()) : $(), scope 2
%10 = global_addr @_TZvOs11CommandLine11_unsafeArgvGSpGSqGSpVs4Int8___ : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 2 // user: %11
store %1 to %10 : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 2 // id: %11
%12 = tuple (), scope 2 // user: %13
return %12 : $(), scope 2 // id: %13
}
sil_scope 3 { loc "example-industrious-two.swift":1:7 parent @_TFC4main9ContainerD : $@convention(method) (@owned Container) -> () }
// Container.__deallocating_deinit
sil hidden @_TFC4main9ContainerD : $@convention(method) (@owned Container) -> () {
// %0 // users: %3, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-industrious-two.swift":1:7, scope 3 // id: %1
// function_ref Container.deinit
%2 = function_ref @_TFC4main9Containerd : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject, scope 3 // user: %3
%3 = apply %2(%0) : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject, scope 3 // user: %4
%4 = unchecked_ref_cast %3 : $Builtin.NativeObject to $Container, scope 3 // user: %5
dealloc_ref %4 : $Container, scope 3 // id: %5
%6 = tuple (), scope 3 // user: %7
return %6 : $(), scope 3 // id: %7
}
sil_scope 4 { loc "example-industrious-two.swift":1:7 parent @_TFC4main9Containerd : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject }
sil_scope 5 { loc "example-industrious-two.swift":1:7 parent 4 }
// Container.deinit
sil hidden @_TFC4main9Containerd : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject {
// %0 // users: %2, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-industrious-two.swift":1:7, scope 4 // id: %1
%2 = unchecked_ref_cast %0 : $Container to $Builtin.NativeObject, scope 5 // user: %3
return %2 : $Builtin.NativeObject, scope 5 // id: %3
}
sil_scope 6 { loc "example-industrious-two.swift":2:7 parent @_TFC4main9Containerg9containedSi : $@convention(method) (@guaranteed Container) -> Int }
sil_scope 7 { loc "example-industrious-two.swift":2:7 parent 6 }
// Container.contained.getter
sil hidden [transparent] @_TFC4main9Containerg9containedSi : $@convention(method) (@guaranteed Container) -> Int {
// %0 // users: %2, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-industrious-two.swift":2:7, scope 6 // id: %1
%2 = ref_element_addr %0 : $Container, #Container.contained, scope 7 // user: %3
%3 = load %2 : $*Int, scope 7 // user: %4
return %3 : $Int, loc "example-industrious-two.swift":2:7, scope 7 // id: %4
}
sil_scope 8 { loc "example-industrious-two.swift":2:7 parent @_TFC4main9Containers9containedSi : $@convention(method) (Int, @guaranteed Container) -> () }
sil_scope 9 { loc "example-industrious-two.swift":2:7 parent 8 }
// Container.contained.setter
sil hidden [transparent] @_TFC4main9Containers9containedSi : $@convention(method) (Int, @guaranteed Container) -> () {
// %0 // users: %5, %2
// %1 // users: %4, %3
bb0(%0 : $Int, %1 : $Container):
debug_value %0 : $Int, let, name "value", argno 1, loc "example-industrious-two.swift":2:7, scope 8 // id: %2
debug_value %1 : $Container, let, name "self", argno 2, loc "example-industrious-two.swift":2:7, scope 8 // id: %3
%4 = ref_element_addr %1 : $Container, #Container.contained, scope 9 // user: %5
store %0 to %4 : $*Int, scope 9 // id: %5
%6 = tuple (), loc "example-industrious-two.swift":2:7, scope 9 // user: %7
return %6 : $(), loc "example-industrious-two.swift":2:7, scope 9 // id: %7
}
sil_scope 10 { loc "example-industrious-two.swift":2:7 parent @_TFC4main9Containerm9containedSi : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Container) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) }
// Container.contained.materializeForSet
sil hidden [transparent] @_TFC4main9Containerm9containedSi : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Container) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
// %2 // user: %3
bb0(%0 : $Builtin.RawPointer, %1 : $*Builtin.UnsafeValueBuffer, %2 : $Container):
%3 = ref_element_addr %2 : $Container, #Container.contained, scope 10 // user: %4
%4 = address_to_pointer %3 : $*Int to $Builtin.RawPointer, scope 10 // user: %6
%5 = enum $Optional<Builtin.RawPointer>, #Optional.none!enumelt, scope 10 // user: %6
%6 = tuple (%4 : $Builtin.RawPointer, %5 : $Optional<Builtin.RawPointer>), scope 10 // user: %7
return %6 : $(Builtin.RawPointer, Optional<Builtin.RawPointer>), scope 10 // id: %7
}
sil_scope 11 { loc "example-industrious-two.swift":3:7 parent @_TFC4main9Containerg6secondSi : $@convention(method) (@guaranteed Container) -> Int }
sil_scope 12 { loc "example-industrious-two.swift":3:7 parent 11 }
// Container.second.getter
sil hidden [transparent] @_TFC4main9Containerg6secondSi : $@convention(method) (@guaranteed Container) -> Int {
// %0 // users: %2, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-industrious-two.swift":3:7, scope 11 // id: %1
%2 = ref_element_addr %0 : $Container, #Container.second, scope 12 // user: %3
%3 = load %2 : $*Int, scope 12 // user: %4
return %3 : $Int, loc "example-industrious-two.swift":3:7, scope 12 // id: %4
}
sil_scope 13 { loc "example-industrious-two.swift":3:7 parent @_TFC4main9Containers6secondSi : $@convention(method) (Int, @guaranteed Container) -> () }
sil_scope 14 { loc "example-industrious-two.swift":3:7 parent 13 }
// Container.second.setter
sil hidden [transparent] @_TFC4main9Containers6secondSi : $@convention(method) (Int, @guaranteed Container) -> () {
// %0 // users: %5, %2
// %1 // users: %4, %3
bb0(%0 : $Int, %1 : $Container):
debug_value %0 : $Int, let, name "value", argno 1, loc "example-industrious-two.swift":3:7, scope 13 // id: %2
debug_value %1 : $Container, let, name "self", argno 2, loc "example-industrious-two.swift":3:7, scope 13 // id: %3
%4 = ref_element_addr %1 : $Container, #Container.second, scope 14 // user: %5
store %0 to %4 : $*Int, scope 14 // id: %5
%6 = tuple (), loc "example-industrious-two.swift":3:7, scope 14 // user: %7
return %6 : $(), loc "example-industrious-two.swift":3:7, scope 14 // id: %7
}
sil_scope 15 { loc "example-industrious-two.swift":3:7 parent @_TFC4main9Containerm6secondSi : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Container) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) }
// Container.second.materializeForSet
sil hidden [transparent] @_TFC4main9Containerm6secondSi : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Container) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
// %2 // user: %3
bb0(%0 : $Builtin.RawPointer, %1 : $*Builtin.UnsafeValueBuffer, %2 : $Container):
%3 = ref_element_addr %2 : $Container, #Container.second, scope 15 // user: %4
%4 = address_to_pointer %3 : $*Int to $Builtin.RawPointer, scope 15 // user: %6
%5 = enum $Optional<Builtin.RawPointer>, #Optional.none!enumelt, scope 15 // user: %6
%6 = tuple (%4 : $Builtin.RawPointer, %5 : $Optional<Builtin.RawPointer>), scope 15 // user: %7
return %6 : $(Builtin.RawPointer, Optional<Builtin.RawPointer>), scope 15 // id: %7
}
sil_scope 16 { loc "example-industrious-two.swift":1:7 parent @_TFC4main9ContainercfT_S0_ : $@convention(method) (@owned Container) -> @owned Container }
sil_scope 17 { parent 16 }
// Container.init() -> Container
sil hidden @_TFC4main9ContainercfT_S0_ : $@convention(method) (@owned Container) -> @owned Container {
// %0 // users: %4, %8, %10, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", loc "example-industrious-two.swift":1:7, scope 16 // id: %1
%2 = integer_literal $Builtin.Int64, 0, loc "example-industrious-two.swift":2:24, scope 16 // user: %3
%3 = struct $Int (%2 : $Builtin.Int64), loc "example-industrious-two.swift":2:24, scope 16 // user: %5
%4 = ref_element_addr %0 : $Container, #Container.contained, loc "example-industrious-two.swift":2:7, scope 16 // user: %5
store %3 to %4 : $*Int, loc "example-industrious-two.swift":2:7, scope 16 // id: %5
%6 = integer_literal $Builtin.Int64, 1, loc "example-industrious-two.swift":3:21, scope 16 // user: %7
%7 = struct $Int (%6 : $Builtin.Int64), loc "example-industrious-two.swift":3:21, scope 16 // user: %9
%8 = ref_element_addr %0 : $Container, #Container.second, loc "example-industrious-two.swift":3:7, scope 16 // user: %9
store %7 to %8 : $*Int, loc "example-industrious-two.swift":3:7, scope 16 // id: %9
return %0 : $Container, loc "example-industrious-two.swift":1:7, scope 17 // id: %10
}
sil_scope 18 { loc "example-industrious-two.swift":1:7 parent @_TFC4main9ContainerCfT_S0_ : $@convention(method) (@thick Container.Type) -> @owned Container }
// Container.__allocating_init() -> Container
sil hidden @_TFC4main9ContainerCfT_S0_ : $@convention(method) (@thick Container.Type) -> @owned Container {
bb0(%0 : $@thick Container.Type):
%1 = alloc_ref $Container, scope 18 // user: %3
// function_ref Container.init() -> Container
%2 = function_ref @_TFC4main9ContainercfT_S0_ : $@convention(method) (@owned Container) -> @owned Container, scope 18 // user: %3
%3 = apply %2(%1) : $@convention(method) (@owned Container) -> @owned Container, scope 18 // user: %4
return %3 : $Container, scope 18 // id: %4
}
sil_scope 19 { parent @_TFSiCfT22_builtinIntegerLiteralBi2048__Si : $@convention(method) (Builtin.Int2048, @thin Int.Type) -> Int }
// Int.init(_builtinIntegerLiteral : Builtin.Int2048) -> Int
sil public_external [transparent] [fragile] @_TFSiCfT22_builtinIntegerLiteralBi2048__Si : $@convention(method) (Builtin.Int2048, @thin Int.Type) -> Int {
// %0 // users: %3, %2
bb0(%0 : $Builtin.Int2048, %1 : $@thin Int.Type):
debug_value %0 : $Builtin.Int2048, scope 19 // id: %2
%3 = builtin "s_to_s_checked_trunc_Int2048_Int64"(%0 : $Builtin.Int2048) : $(Builtin.Int64, Builtin.Int1), scope 19 // user: %4
%4 = tuple_extract %3 : $(Builtin.Int64, Builtin.Int1), 0, scope 19 // user: %5
%5 = struct $Int (%4 : $Builtin.Int64), scope 19 // user: %6
return %5 : $Int, scope 19 // id: %6
}
// globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4
sil private_external [fragile] @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4 : $@convention(thin) () -> ()
sil_vtable Container {
#Container.deinit!deallocator: _TFC4main9ContainerD // Container.__deallocating_deinit
#Container.contained!getter.1: _TFC4main9Containerg9containedSi // Container.contained.getter
#Container.contained!setter.1: _TFC4main9Containers9containedSi // Container.contained.setter
#Container.contained!materializeForSet.1: _TFC4main9Containerm9containedSi // Container.contained.materializeForSet
#Container.second!getter.1: _TFC4main9Containerg6secondSi // Container.second.getter
#Container.second!setter.1: _TFC4main9Containers6secondSi // Container.second.setter
#Container.second!materializeForSet.1: _TFC4main9Containerm6secondSi // Container.second.materializeForSet
#Container.init!initializer.1: _TFC4main9ContainercfT_S0_ // Container.init() -> Container
}
class Container {
var contained: Int = 0
var second: Int = 1
}
sil_stage canonical
import Builtin
import Swift
import SwiftShims
// static CommandLine._argc
sil_global [fragile] @_TZvOs11CommandLine5_argcVs5Int32 : $Int32
// globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4
sil_global private_external [fragile] @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4 : $Builtin.Word
// static CommandLine._unsafeArgv
sil_global [fragile] @_TZvOs11CommandLine11_unsafeArgvGSpGSqGSpVs4Int8___ : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>
sil_scope 1 { parent @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 }
// main
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
// %0 // user: %3
// %1 // user: %9
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
%2 = global_addr @_TZvOs11CommandLine5_argcVs5Int32 : $*Int32, scope 1 // user: %3
store %0 to %2 : $*Int32, scope 1 // id: %3
%4 = global_addr @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4 : $*Builtin.Word, scope 1 // user: %5
%5 = address_to_pointer %4 : $*Builtin.Word to $Builtin.RawPointer, scope 1 // user: %7
// function_ref globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4
%6 = function_ref @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4 : $@convention(thin) () -> (), scope 1 // user: %7
%7 = builtin "once"(%5 : $Builtin.RawPointer, %6 : $@convention(thin) () -> ()) : $(), scope 1
%8 = global_addr @_TZvOs11CommandLine11_unsafeArgvGSpGSqGSpVs4Int8___ : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 1 // user: %9
store %1 to %8 : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 1 // id: %9
%10 = tuple (), scope 1
%11 = integer_literal $Builtin.Int32, 0, scope 1 // user: %12
%12 = struct $Int32 (%11 : $Builtin.Int32), scope 1 // user: %13
return %12 : $Int32, scope 1 // id: %13
}
sil_scope 2 { parent @_TFs20_stdlib_didEnterMainFT4argcVs5Int324argvGSpGSqGSpVs4Int8____T_ : $@convention(thin) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> () }
// _stdlib_didEnterMain(argc : Int32, argv : UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>) -> ()
sil public_external [transparent] [fragile] @_TFs20_stdlib_didEnterMainFT4argcVs5Int324argvGSpGSqGSpVs4Int8____T_ : $@convention(thin) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> () {
// %0 // users: %5, %2
// %1 // users: %11, %3
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
debug_value %0 : $Int32, scope 2 // id: %2
debug_value %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 2 // id: %3
%4 = global_addr @_TZvOs11CommandLine5_argcVs5Int32 : $*Int32, scope 2 // user: %5
store %0 to %4 : $*Int32, scope 2 // id: %5
%6 = global_addr @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4 : $*Builtin.Word, scope 2 // user: %7
%7 = address_to_pointer %6 : $*Builtin.Word to $Builtin.RawPointer, scope 2 // user: %9
// function_ref globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4
%8 = function_ref @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4 : $@convention(thin) () -> (), scope 2 // user: %9
%9 = builtin "once"(%7 : $Builtin.RawPointer, %8 : $@convention(thin) () -> ()) : $(), scope 2
%10 = global_addr @_TZvOs11CommandLine11_unsafeArgvGSpGSqGSpVs4Int8___ : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 2 // user: %11
store %1 to %10 : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 2 // id: %11
%12 = tuple (), scope 2 // user: %13
return %12 : $(), scope 2 // id: %13
}
sil_scope 3 { loc "example-lazy-one.swift":1:7 parent @_TFC4main9ContainerD : $@convention(method) (@owned Container) -> () }
// Container.__deallocating_deinit
sil hidden @_TFC4main9ContainerD : $@convention(method) (@owned Container) -> () {
// %0 // users: %3, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-lazy-one.swift":1:7, scope 3 // id: %1
// function_ref Container.deinit
%2 = function_ref @_TFC4main9Containerd : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject, scope 3 // user: %3
%3 = apply %2(%0) : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject, scope 3 // user: %4
%4 = unchecked_ref_cast %3 : $Builtin.NativeObject to $Container, scope 3 // user: %5
dealloc_ref %4 : $Container, scope 3 // id: %5
%6 = tuple (), scope 3 // user: %7
return %6 : $(), scope 3 // id: %7
}
sil_scope 4 { loc "example-lazy-one.swift":1:7 parent @_TFC4main9Containerd : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject }
sil_scope 5 { loc "example-lazy-one.swift":1:7 parent 4 }
// Container.deinit
sil hidden @_TFC4main9Containerd : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject {
// %0 // users: %2, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-lazy-one.swift":1:7, scope 4 // id: %1
%2 = unchecked_ref_cast %0 : $Container to $Builtin.NativeObject, scope 5 // user: %3
return %2 : $Builtin.NativeObject, scope 5 // id: %3
}
sil_scope 6 { loc "example-lazy-one.swift":2:12 parent @_TFC4main9Containerg9containedSi : $@convention(method) (@guaranteed Container) -> Int }
sil_scope 7 { loc "example-lazy-one.swift":2:12 parent 6 }
sil_scope 8 { parent 7 }
// Container.contained.getter
sil hidden @_TFC4main9Containerg9containedSi : $@convention(method) (@guaranteed Container) -> Int {
// %0 // users: %35, %2, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-lazy-one.swift":2:12, scope 6 // id: %1
%2 = ref_element_addr %0 : $Container, #Container.contained.storage, scope 7 // user: %3
%3 = load %2 : $*Optional<Int>, scope 7 // users: %29, %11, %7, %4
debug_value %3 : $Optional<Int>, let, name "tmp1", scope 7 // id: %4
%5 = integer_literal $Builtin.Int1, -1, scope 8 // user: %7
%6 = integer_literal $Builtin.Int1, 0, scope 8 // user: %7
%7 = select_enum %3 : $Optional<Int>, case #Optional.some!enumelt.1: %5, default %6 : $Builtin.Int1, scope 8 // user: %8
%8 = struct $Bool (%7 : $Builtin.Int1), scope 8 // user: %9
%9 = struct_extract %8 : $Bool, #Bool._value, scope 8 // user: %10
cond_br %9, bb1, bb7, scope 8 // id: %10
bb1: // Preds: bb0
switch_enum %3 : $Optional<Int>, case #Optional.none!enumelt: bb2, default bb6, scope 8 // id: %11
bb2: // Preds: bb1
br bb3, scope 8 // id: %12
bb3: // Preds: bb2
br bb4, scope 8 // id: %13
bb4: // Preds: bb3
br bb5, scope 8 // id: %14
bb5: // Preds: bb4
%15 = string_literal utf8 "unexpectedly found nil while unwrapping an Optional value", scope 8 // user: %17
%16 = integer_literal $Builtin.Word, 57, scope 8 // user: %19
%17 = builtin "ptrtoint_Word"(%15 : $Builtin.RawPointer) : $Builtin.Word, scope 8 // user: %19
%18 = integer_literal $Builtin.Int8, 2, scope 8 // users: %23, %19
%19 = struct $StaticString (%17 : $Builtin.Word, %16 : $Builtin.Word, %18 : $Builtin.Int8), scope 8 // user: %27
%20 = string_literal utf8 "fatal error", scope 8 // user: %22
%21 = integer_literal $Builtin.Word, 11, scope 8 // user: %23
%22 = builtin "ptrtoint_Word"(%20 : $Builtin.RawPointer) : $Builtin.Word, scope 8 // user: %23
%23 = struct $StaticString (%22 : $Builtin.Word, %21 : $Builtin.Word, %18 : $Builtin.Int8), scope 8 // user: %27
%24 = integer_literal $Builtin.Int32, 1, scope 8 // user: %25
%25 = struct $UInt32 (%24 : $Builtin.Int32), scope 8 // user: %27
// function_ref specialized _fatalErrorMessage(StaticString, StaticString, StaticString, UInt, flags : UInt32) -> Never
%26 = function_ref @_TTSfq4n_n_d_d_n___TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su5flagsVs6UInt32_Os5Never : $@convention(thin) (StaticString, StaticString, UInt32) -> Never, scope 8 // user: %27
%27 = apply %26(%23, %19, %25) : $@convention(thin) (StaticString, StaticString, UInt32) -> Never, scope 8
unreachable, scope 6 // id: %28
bb6: // Preds: bb1
%29 = unchecked_enum_data %3 : $Optional<Int>, #Optional.some!enumelt.1, scope 8 // user: %30
br bb8(%29 : $Int), scope 8 // id: %30
bb7: // Preds: bb0
%31 = integer_literal $Builtin.Int64, 0, loc "example-lazy-one.swift":2:29, scope 7 // user: %32
%32 = struct $Int (%31 : $Builtin.Int64), loc "example-lazy-one.swift":2:29, scope 7 // users: %33, %34, %37
debug_value %32 : $Int, let, name "tmp2", scope 7 // id: %33
%34 = enum $Optional<Int>, #Optional.some!enumelt.1, %32 : $Int, scope 7 // user: %36
%35 = ref_element_addr %0 : $Container, #Container.contained.storage, scope 7 // user: %36
store %34 to %35 : $*Optional<Int>, scope 7 // id: %36
br bb8(%32 : $Int), scope 7 // id: %37
// %38 // user: %39
bb8(%38 : $Int): // Preds: bb7 bb6
return %38 : $Int, loc "example-lazy-one.swift":2:12, scope 7 // id: %39
}
sil_scope 9 { parent @_TFSb21_getBuiltinLogicValuefT_Bi1_ : $@convention(method) (Bool) -> Builtin.Int1 }
// Bool._getBuiltinLogicValue() -> Builtin.Int1
sil public_external [transparent] [fragile] @_TFSb21_getBuiltinLogicValuefT_Bi1_ : $@convention(method) (Bool) -> Builtin.Int1 {
// %0 // users: %2, %1
bb0(%0 : $Bool):
debug_value %0 : $Bool, scope 9 // id: %1
%2 = struct_extract %0 : $Bool, #Bool._value, scope 9 // user: %3
return %2 : $Builtin.Int1, scope 9 // id: %3
}
sil_scope 10 { parent @_TFs8_getBoolFBi1_Sb : $@convention(thin) (Builtin.Int1) -> Bool }
// _getBool(Builtin.Int1) -> Bool
sil public_external [transparent] [fragile] @_TFs8_getBoolFBi1_Sb : $@convention(thin) (Builtin.Int1) -> Bool {
// %0 // users: %2, %1
bb0(%0 : $Builtin.Int1):
debug_value %0 : $Builtin.Int1, scope 10 // id: %1
%2 = struct $Bool (%0 : $Builtin.Int1), scope 10 // user: %3
return %2 : $Bool, scope 10 // id: %3
}
sil_scope 11 { parent @_TFs30_diagnoseUnexpectedNilOptionalFT14_filenameStartBp15_filenameLengthBw16_filenameIsASCIIBi1_5_lineBw_T_ : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word) -> () }
// _diagnoseUnexpectedNilOptional(_filenameStart : Builtin.RawPointer, _filenameLength : Builtin.Word, _filenameIsASCII : Builtin.Int1, _line : Builtin.Word) -> ()
sil public_external [transparent] [fragile] @_TFs30_diagnoseUnexpectedNilOptionalFT14_filenameStartBp15_filenameLengthBw16_filenameIsASCIIBi1_5_lineBw_T_ : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word) -> () {
// %2 // users: %5, %4
bb0(%0 : $Builtin.RawPointer, %1 : $Builtin.Word, %2 : $Builtin.Int1, %3 : $Builtin.Word):
debug_value %2 : $Builtin.Int1, scope 11 // id: %4
cond_br %2, bb3, bb1, scope 11 // id: %5
bb1: // Preds: bb0
br bb2, scope 11 // id: %6
bb2: // Preds: bb1
br bb5, scope 11 // id: %7
bb3: // Preds: bb0
br bb4, scope 11 // id: %8
bb4: // Preds: bb3
br bb5, scope 11 // id: %9
bb5: // Preds: bb4 bb2
%10 = string_literal utf8 "unexpectedly found nil while unwrapping an Optional value", scope 11 // user: %12
%11 = integer_literal $Builtin.Word, 57, scope 11 // user: %14
%12 = builtin "ptrtoint_Word"(%10 : $Builtin.RawPointer) : $Builtin.Word, scope 11 // user: %14
%13 = integer_literal $Builtin.Int8, 2, scope 11 // users: %18, %14
%14 = struct $StaticString (%12 : $Builtin.Word, %11 : $Builtin.Word, %13 : $Builtin.Int8), scope 11 // user: %22
%15 = string_literal utf8 "fatal error", scope 11 // user: %17
%16 = integer_literal $Builtin.Word, 11, scope 11 // user: %18
%17 = builtin "ptrtoint_Word"(%15 : $Builtin.RawPointer) : $Builtin.Word, scope 11 // user: %18
%18 = struct $StaticString (%17 : $Builtin.Word, %16 : $Builtin.Word, %13 : $Builtin.Int8), scope 11 // user: %22
%19 = integer_literal $Builtin.Int32, 1, scope 11 // user: %20
%20 = struct $UInt32 (%19 : $Builtin.Int32), scope 11 // user: %22
// function_ref specialized _fatalErrorMessage(StaticString, StaticString, StaticString, UInt, flags : UInt32) -> Never
%21 = function_ref @_TTSfq4n_n_d_d_n___TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su5flagsVs6UInt32_Os5Never : $@convention(thin) (StaticString, StaticString, UInt32) -> Never, scope 11 // user: %22
%22 = apply %21(%18, %14, %20) : $@convention(thin) (StaticString, StaticString, UInt32) -> Never, scope 11
unreachable, scope 11 // id: %23
}
sil_scope 12 { parent @_TFSiCfT22_builtinIntegerLiteralBi2048__Si : $@convention(method) (Builtin.Int2048, @thin Int.Type) -> Int }
// Int.init(_builtinIntegerLiteral : Builtin.Int2048) -> Int
sil public_external [transparent] [fragile] @_TFSiCfT22_builtinIntegerLiteralBi2048__Si : $@convention(method) (Builtin.Int2048, @thin Int.Type) -> Int {
// %0 // users: %3, %2
bb0(%0 : $Builtin.Int2048, %1 : $@thin Int.Type):
debug_value %0 : $Builtin.Int2048, scope 12 // id: %2
%3 = builtin "s_to_s_checked_trunc_Int2048_Int64"(%0 : $Builtin.Int2048) : $(Builtin.Int64, Builtin.Int1), scope 12 // user: %4
%4 = tuple_extract %3 : $(Builtin.Int64, Builtin.Int1), 0, scope 12 // user: %5
%5 = struct $Int (%4 : $Builtin.Int64), scope 12 // user: %6
return %5 : $Int, scope 12 // id: %6
}
sil_scope 13 { loc "example-lazy-one.swift":2:12 parent @_TFC4main9Containers9containedSi : $@convention(method) (Int, @guaranteed Container) -> () }
sil_scope 14 { loc "example-lazy-one.swift":2:12 parent 13 }
// Container.contained.setter
sil hidden [transparent] @_TFC4main9Containers9containedSi : $@convention(method) (Int, @guaranteed Container) -> () {
// %0 // users: %4, %2
// %1 // users: %5, %3
bb0(%0 : $Int, %1 : $Container):
debug_value %0 : $Int, let, name "value", argno 1, loc "example-lazy-one.swift":2:12, scope 13 // id: %2
debug_value %1 : $Container, let, name "self", argno 2, loc "example-lazy-one.swift":2:12, scope 13 // id: %3
%4 = enum $Optional<Int>, #Optional.some!enumelt.1, %0 : $Int, scope 14 // user: %6
%5 = ref_element_addr %1 : $Container, #Container.contained.storage, scope 14 // user: %6
store %4 to %5 : $*Optional<Int>, scope 14 // id: %6
%7 = tuple (), loc "example-lazy-one.swift":2:12, scope 14 // user: %8
return %7 : $(), loc "example-lazy-one.swift":2:12, scope 14 // id: %8
}
sil_scope 15 { loc "example-lazy-one.swift":2:12 parent @_TFC4main9Containerm9containedSi : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Container) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) }
// Container.contained.materializeForSet
sil hidden [transparent] @_TFC4main9Containerm9containedSi : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Container) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
// %0 // user: %3
// %2 // user: %5
bb0(%0 : $Builtin.RawPointer, %1 : $*Builtin.UnsafeValueBuffer, %2 : $Container):
%3 = pointer_to_address %0 : $Builtin.RawPointer to [strict] $*Int, scope 15 // users: %7, %6
// function_ref Container.contained.getter
%4 = function_ref @_TFC4main9Containerg9containedSi : $@convention(method) (@guaranteed Container) -> Int, scope 15 // user: %5
%5 = apply %4(%2) : $@convention(method) (@guaranteed Container) -> Int, scope 15 // user: %6
store %5 to %3 : $*Int, scope 15 // id: %6
%7 = address_to_pointer %3 : $*Int to $Builtin.RawPointer, scope 15 // user: %11
// function_ref Container.(contained.materializeForSet).(closure #1)
%8 = function_ref @_TFFC4main9Containerm9containedSiU_T_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Container, @thick Container.Type) -> (), scope 15 // user: %9
%9 = thin_function_to_pointer %8 : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Container, @thick Container.Type) -> () to $Builtin.RawPointer, scope 15 // user: %10
%10 = enum $Optional<Builtin.RawPointer>, #Optional.some!enumelt.1, %9 : $Builtin.RawPointer, scope 15 // user: %11
%11 = tuple (%7 : $Builtin.RawPointer, %10 : $Optional<Builtin.RawPointer>), scope 15 // user: %12
return %11 : $(Builtin.RawPointer, Optional<Builtin.RawPointer>), scope 15 // id: %12
}
sil_scope 16 { loc "example-lazy-one.swift":2:12 parent @_TFFC4main9Containerm9containedSiU_T_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Container, @thick Container.Type) -> () }
sil_scope 17 { parent 16 }
// Container.(contained.materializeForSet).(closure #1)
sil hidden [transparent] @_TFFC4main9Containerm9containedSiU_T_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Container, @thick Container.Type) -> () {
// %0 // user: %5
// %2 // user: %4
bb0(%0 : $Builtin.RawPointer, %1 : $*Builtin.UnsafeValueBuffer, %2 : $*Container, %3 : $@thick Container.Type):
%4 = load %2 : $*Container, scope 17 // user: %8
%5 = pointer_to_address %0 : $Builtin.RawPointer to [strict] $*Int, scope 17 // user: %6
%6 = load %5 : $*Int, scope 17 // user: %7
%7 = enum $Optional<Int>, #Optional.some!enumelt.1, %6 : $Int, scope 17 // user: %9
%8 = ref_element_addr %4 : $Container, #Container.contained.storage, scope 17 // user: %9
store %7 to %8 : $*Optional<Int>, scope 17 // id: %9
%10 = tuple (), scope 17
%11 = tuple (), scope 17 // user: %12
return %11 : $(), scope 17 // id: %12
}
sil_scope 18 { loc "example-lazy-one.swift":1:7 parent @_TFC4main9ContainercfT_S0_ : $@convention(method) (@owned Container) -> @owned Container }
sil_scope 19 { parent 18 }
// Container.init() -> Container
sil hidden @_TFC4main9ContainercfT_S0_ : $@convention(method) (@owned Container) -> @owned Container {
// %0 // users: %6, %9, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", loc "example-lazy-one.swift":1:7, scope 18 // id: %1
%2 = alloc_stack $Optional<Int>, scope 18 // users: %3, %8, %5
inject_enum_addr %2 : $*Optional<Int>, #Optional.none!enumelt, scope 18 // id: %3
%4 = tuple (), scope 18
%5 = load %2 : $*Optional<Int>, scope 18 // user: %7
%6 = ref_element_addr %0 : $Container, #Container.contained.storage, loc "example-lazy-one.swift":2:12, scope 18 // user: %7
store %5 to %6 : $*Optional<Int>, loc "example-lazy-one.swift":2:12, scope 18 // id: %7
dealloc_stack %2 : $*Optional<Int>, loc "example-lazy-one.swift":2:12, scope 18 // id: %8
return %0 : $Container, loc "example-lazy-one.swift":1:7, scope 19 // id: %9
}
sil_scope 20 { loc "example-lazy-one.swift":1:7 parent @_TFC4main9ContainerCfT_S0_ : $@convention(method) (@thick Container.Type) -> @owned Container }
// Container.__allocating_init() -> Container
sil hidden @_TFC4main9ContainerCfT_S0_ : $@convention(method) (@thick Container.Type) -> @owned Container {
bb0(%0 : $@thick Container.Type):
%1 = alloc_ref $Container, scope 20 // user: %3
// function_ref Container.init() -> Container
%2 = function_ref @_TFC4main9ContainercfT_S0_ : $@convention(method) (@owned Container) -> @owned Container, scope 20 // user: %3
%3 = apply %2(%1) : $@convention(method) (@owned Container) -> @owned Container, scope 20 // user: %4
return %3 : $Container, scope 20 // id: %4
}
sil_scope 21 { parent @_TFSqCfT10nilLiteralT__GSqx_ : $@convention(method) <τ_0_0> (@thin Optional<τ_0_0>.Type) -> @out Optional<τ_0_0> }
// Optional.init(nilLiteral : ()) -> A?
sil public_external [transparent] [fragile] @_TFSqCfT10nilLiteralT__GSqx_ : $@convention(method) <Wrapped> (@thin Optional<Wrapped>.Type) -> @out Optional<Wrapped> {
// %0 // user: %2
bb0(%0 : $*Optional<Wrapped>, %1 : $@thin Optional<Wrapped>.Type):
inject_enum_addr %0 : $*Optional<Wrapped>, #Optional.none!enumelt, scope 21 // id: %2
%3 = tuple (), scope 21 // user: %4
return %3 : $(), scope 21 // id: %4
}
// globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4
sil private_external [fragile] @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4 : $@convention(thin) () -> ()
// specialized _fatalErrorMessage(StaticString, StaticString, StaticString, UInt, flags : UInt32) -> Never
sil [fragile] [noinline] [_semantics "arc.programtermination_point"] [_semantics "stdlib_binary_only"] @_TTSfq4n_n_d_d_n___TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su5flagsVs6UInt32_Os5Never : $@convention(thin) (StaticString, StaticString, UInt32) -> Never
sil_vtable Container {
#Container.deinit!deallocator: _TFC4main9ContainerD // Container.__deallocating_deinit
#Container.contained!getter.1: _TFC4main9Containerg9containedSi // Container.contained.getter
#Container.contained!setter.1: _TFC4main9Containers9containedSi // Container.contained.setter
#Container.contained!materializeForSet.1: _TFC4main9Containerm9containedSi // Container.contained.materializeForSet
#Container.init!initializer.1: _TFC4main9ContainercfT_S0_ // Container.init() -> Container
}
class Container {
lazy var contained: Int = 0
}
sil_stage canonical
import Builtin
import Swift
import SwiftShims
// static CommandLine._argc
sil_global [fragile] @_TZvOs11CommandLine5_argcVs5Int32 : $Int32
// globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4
sil_global private_external [fragile] @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4 : $Builtin.Word
// static CommandLine._unsafeArgv
sil_global [fragile] @_TZvOs11CommandLine11_unsafeArgvGSpGSqGSpVs4Int8___ : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>
sil_scope 1 { parent @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 }
// main
sil @main : $@convention(c) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> Int32 {
// %0 // user: %3
// %1 // user: %9
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
%2 = global_addr @_TZvOs11CommandLine5_argcVs5Int32 : $*Int32, scope 1 // user: %3
store %0 to %2 : $*Int32, scope 1 // id: %3
%4 = global_addr @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4 : $*Builtin.Word, scope 1 // user: %5
%5 = address_to_pointer %4 : $*Builtin.Word to $Builtin.RawPointer, scope 1 // user: %7
// function_ref globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4
%6 = function_ref @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4 : $@convention(thin) () -> (), scope 1 // user: %7
%7 = builtin "once"(%5 : $Builtin.RawPointer, %6 : $@convention(thin) () -> ()) : $(), scope 1
%8 = global_addr @_TZvOs11CommandLine11_unsafeArgvGSpGSqGSpVs4Int8___ : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 1 // user: %9
store %1 to %8 : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 1 // id: %9
%10 = tuple (), scope 1
%11 = integer_literal $Builtin.Int32, 0, scope 1 // user: %12
%12 = struct $Int32 (%11 : $Builtin.Int32), scope 1 // user: %13
return %12 : $Int32, scope 1 // id: %13
}
sil_scope 2 { parent @_TFs20_stdlib_didEnterMainFT4argcVs5Int324argvGSpGSqGSpVs4Int8____T_ : $@convention(thin) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> () }
// _stdlib_didEnterMain(argc : Int32, argv : UnsafeMutablePointer<UnsafeMutablePointer<Int8>?>) -> ()
sil public_external [transparent] [fragile] @_TFs20_stdlib_didEnterMainFT4argcVs5Int324argvGSpGSqGSpVs4Int8____T_ : $@convention(thin) (Int32, UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>) -> () {
// %0 // users: %5, %2
// %1 // users: %11, %3
bb0(%0 : $Int32, %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>):
debug_value %0 : $Int32, scope 2 // id: %2
debug_value %1 : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 2 // id: %3
%4 = global_addr @_TZvOs11CommandLine5_argcVs5Int32 : $*Int32, scope 2 // user: %5
store %0 to %4 : $*Int32, scope 2 // id: %5
%6 = global_addr @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_token4 : $*Builtin.Word, scope 2 // user: %7
%7 = address_to_pointer %6 : $*Builtin.Word to $Builtin.RawPointer, scope 2 // user: %9
// function_ref globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4
%8 = function_ref @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4 : $@convention(thin) () -> (), scope 2 // user: %9
%9 = builtin "once"(%7 : $Builtin.RawPointer, %8 : $@convention(thin) () -> ()) : $(), scope 2
%10 = global_addr @_TZvOs11CommandLine11_unsafeArgvGSpGSqGSpVs4Int8___ : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 2 // user: %11
store %1 to %10 : $*UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>, scope 2 // id: %11
%12 = tuple (), scope 2 // user: %13
return %12 : $(), scope 2 // id: %13
}
sil_scope 3 { loc "example-lazy-two.swift":1:7 parent @_TFC4main9ContainerD : $@convention(method) (@owned Container) -> () }
// Container.__deallocating_deinit
sil hidden @_TFC4main9ContainerD : $@convention(method) (@owned Container) -> () {
// %0 // users: %3, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-lazy-two.swift":1:7, scope 3 // id: %1
// function_ref Container.deinit
%2 = function_ref @_TFC4main9Containerd : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject, scope 3 // user: %3
%3 = apply %2(%0) : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject, scope 3 // user: %4
%4 = unchecked_ref_cast %3 : $Builtin.NativeObject to $Container, scope 3 // user: %5
dealloc_ref %4 : $Container, scope 3 // id: %5
%6 = tuple (), scope 3 // user: %7
return %6 : $(), scope 3 // id: %7
}
sil_scope 4 { loc "example-lazy-two.swift":1:7 parent @_TFC4main9Containerd : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject }
sil_scope 5 { loc "example-lazy-two.swift":1:7 parent 4 }
// Container.deinit
sil hidden @_TFC4main9Containerd : $@convention(method) (@guaranteed Container) -> @owned Builtin.NativeObject {
// %0 // users: %2, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-lazy-two.swift":1:7, scope 4 // id: %1
%2 = unchecked_ref_cast %0 : $Container to $Builtin.NativeObject, scope 5 // user: %3
return %2 : $Builtin.NativeObject, scope 5 // id: %3
}
sil_scope 6 { loc "example-lazy-two.swift":2:12 parent @_TFC4main9Containerg9containedSi : $@convention(method) (@guaranteed Container) -> Int }
sil_scope 7 { loc "example-lazy-two.swift":2:12 parent 6 }
sil_scope 8 { parent 7 }
// Container.contained.getter
sil hidden @_TFC4main9Containerg9containedSi : $@convention(method) (@guaranteed Container) -> Int {
// %0 // users: %35, %2, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-lazy-two.swift":2:12, scope 6 // id: %1
%2 = ref_element_addr %0 : $Container, #Container.contained.storage, scope 7 // user: %3
%3 = load %2 : $*Optional<Int>, scope 7 // users: %29, %11, %7, %4
debug_value %3 : $Optional<Int>, let, name "tmp1", scope 7 // id: %4
%5 = integer_literal $Builtin.Int1, -1, scope 8 // user: %7
%6 = integer_literal $Builtin.Int1, 0, scope 8 // user: %7
%7 = select_enum %3 : $Optional<Int>, case #Optional.some!enumelt.1: %5, default %6 : $Builtin.Int1, scope 8 // user: %8
%8 = struct $Bool (%7 : $Builtin.Int1), scope 8 // user: %9
%9 = struct_extract %8 : $Bool, #Bool._value, scope 8 // user: %10
cond_br %9, bb1, bb7, scope 8 // id: %10
bb1: // Preds: bb0
switch_enum %3 : $Optional<Int>, case #Optional.none!enumelt: bb2, default bb6, scope 8 // id: %11
bb2: // Preds: bb1
br bb3, scope 8 // id: %12
bb3: // Preds: bb2
br bb4, scope 8 // id: %13
bb4: // Preds: bb3
br bb5, scope 8 // id: %14
bb5: // Preds: bb4
%15 = string_literal utf8 "unexpectedly found nil while unwrapping an Optional value", scope 8 // user: %17
%16 = integer_literal $Builtin.Word, 57, scope 8 // user: %19
%17 = builtin "ptrtoint_Word"(%15 : $Builtin.RawPointer) : $Builtin.Word, scope 8 // user: %19
%18 = integer_literal $Builtin.Int8, 2, scope 8 // users: %23, %19
%19 = struct $StaticString (%17 : $Builtin.Word, %16 : $Builtin.Word, %18 : $Builtin.Int8), scope 8 // user: %27
%20 = string_literal utf8 "fatal error", scope 8 // user: %22
%21 = integer_literal $Builtin.Word, 11, scope 8 // user: %23
%22 = builtin "ptrtoint_Word"(%20 : $Builtin.RawPointer) : $Builtin.Word, scope 8 // user: %23
%23 = struct $StaticString (%22 : $Builtin.Word, %21 : $Builtin.Word, %18 : $Builtin.Int8), scope 8 // user: %27
%24 = integer_literal $Builtin.Int32, 1, scope 8 // user: %25
%25 = struct $UInt32 (%24 : $Builtin.Int32), scope 8 // user: %27
// function_ref specialized _fatalErrorMessage(StaticString, StaticString, StaticString, UInt, flags : UInt32) -> Never
%26 = function_ref @_TTSfq4n_n_d_d_n___TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su5flagsVs6UInt32_Os5Never : $@convention(thin) (StaticString, StaticString, UInt32) -> Never, scope 8 // user: %27
%27 = apply %26(%23, %19, %25) : $@convention(thin) (StaticString, StaticString, UInt32) -> Never, scope 8
unreachable, scope 6 // id: %28
bb6: // Preds: bb1
%29 = unchecked_enum_data %3 : $Optional<Int>, #Optional.some!enumelt.1, scope 8 // user: %30
br bb8(%29 : $Int), scope 8 // id: %30
bb7: // Preds: bb0
%31 = integer_literal $Builtin.Int64, 0, loc "example-lazy-two.swift":2:29, scope 7 // user: %32
%32 = struct $Int (%31 : $Builtin.Int64), loc "example-lazy-two.swift":2:29, scope 7 // users: %33, %34, %37
debug_value %32 : $Int, let, name "tmp2", scope 7 // id: %33
%34 = enum $Optional<Int>, #Optional.some!enumelt.1, %32 : $Int, scope 7 // user: %36
%35 = ref_element_addr %0 : $Container, #Container.contained.storage, scope 7 // user: %36
store %34 to %35 : $*Optional<Int>, scope 7 // id: %36
br bb8(%32 : $Int), scope 7 // id: %37
// %38 // user: %39
bb8(%38 : $Int): // Preds: bb7 bb6
return %38 : $Int, loc "example-lazy-two.swift":2:12, scope 7 // id: %39
}
sil_scope 9 { parent @_TFSb21_getBuiltinLogicValuefT_Bi1_ : $@convention(method) (Bool) -> Builtin.Int1 }
// Bool._getBuiltinLogicValue() -> Builtin.Int1
sil public_external [transparent] [fragile] @_TFSb21_getBuiltinLogicValuefT_Bi1_ : $@convention(method) (Bool) -> Builtin.Int1 {
// %0 // users: %2, %1
bb0(%0 : $Bool):
debug_value %0 : $Bool, scope 9 // id: %1
%2 = struct_extract %0 : $Bool, #Bool._value, scope 9 // user: %3
return %2 : $Builtin.Int1, scope 9 // id: %3
}
sil_scope 10 { parent @_TFs8_getBoolFBi1_Sb : $@convention(thin) (Builtin.Int1) -> Bool }
// _getBool(Builtin.Int1) -> Bool
sil public_external [transparent] [fragile] @_TFs8_getBoolFBi1_Sb : $@convention(thin) (Builtin.Int1) -> Bool {
// %0 // users: %2, %1
bb0(%0 : $Builtin.Int1):
debug_value %0 : $Builtin.Int1, scope 10 // id: %1
%2 = struct $Bool (%0 : $Builtin.Int1), scope 10 // user: %3
return %2 : $Bool, scope 10 // id: %3
}
sil_scope 11 { parent @_TFs30_diagnoseUnexpectedNilOptionalFT14_filenameStartBp15_filenameLengthBw16_filenameIsASCIIBi1_5_lineBw_T_ : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word) -> () }
// _diagnoseUnexpectedNilOptional(_filenameStart : Builtin.RawPointer, _filenameLength : Builtin.Word, _filenameIsASCII : Builtin.Int1, _line : Builtin.Word) -> ()
sil public_external [transparent] [fragile] @_TFs30_diagnoseUnexpectedNilOptionalFT14_filenameStartBp15_filenameLengthBw16_filenameIsASCIIBi1_5_lineBw_T_ : $@convention(thin) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, Builtin.Word) -> () {
// %2 // users: %5, %4
bb0(%0 : $Builtin.RawPointer, %1 : $Builtin.Word, %2 : $Builtin.Int1, %3 : $Builtin.Word):
debug_value %2 : $Builtin.Int1, scope 11 // id: %4
cond_br %2, bb3, bb1, scope 11 // id: %5
bb1: // Preds: bb0
br bb2, scope 11 // id: %6
bb2: // Preds: bb1
br bb5, scope 11 // id: %7
bb3: // Preds: bb0
br bb4, scope 11 // id: %8
bb4: // Preds: bb3
br bb5, scope 11 // id: %9
bb5: // Preds: bb4 bb2
%10 = string_literal utf8 "unexpectedly found nil while unwrapping an Optional value", scope 11 // user: %12
%11 = integer_literal $Builtin.Word, 57, scope 11 // user: %14
%12 = builtin "ptrtoint_Word"(%10 : $Builtin.RawPointer) : $Builtin.Word, scope 11 // user: %14
%13 = integer_literal $Builtin.Int8, 2, scope 11 // users: %18, %14
%14 = struct $StaticString (%12 : $Builtin.Word, %11 : $Builtin.Word, %13 : $Builtin.Int8), scope 11 // user: %22
%15 = string_literal utf8 "fatal error", scope 11 // user: %17
%16 = integer_literal $Builtin.Word, 11, scope 11 // user: %18
%17 = builtin "ptrtoint_Word"(%15 : $Builtin.RawPointer) : $Builtin.Word, scope 11 // user: %18
%18 = struct $StaticString (%17 : $Builtin.Word, %16 : $Builtin.Word, %13 : $Builtin.Int8), scope 11 // user: %22
%19 = integer_literal $Builtin.Int32, 1, scope 11 // user: %20
%20 = struct $UInt32 (%19 : $Builtin.Int32), scope 11 // user: %22
// function_ref specialized _fatalErrorMessage(StaticString, StaticString, StaticString, UInt, flags : UInt32) -> Never
%21 = function_ref @_TTSfq4n_n_d_d_n___TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su5flagsVs6UInt32_Os5Never : $@convention(thin) (StaticString, StaticString, UInt32) -> Never, scope 11 // user: %22
%22 = apply %21(%18, %14, %20) : $@convention(thin) (StaticString, StaticString, UInt32) -> Never, scope 11
unreachable, scope 11 // id: %23
}
sil_scope 12 { parent @_TFSiCfT22_builtinIntegerLiteralBi2048__Si : $@convention(method) (Builtin.Int2048, @thin Int.Type) -> Int }
// Int.init(_builtinIntegerLiteral : Builtin.Int2048) -> Int
sil public_external [transparent] [fragile] @_TFSiCfT22_builtinIntegerLiteralBi2048__Si : $@convention(method) (Builtin.Int2048, @thin Int.Type) -> Int {
// %0 // users: %3, %2
bb0(%0 : $Builtin.Int2048, %1 : $@thin Int.Type):
debug_value %0 : $Builtin.Int2048, scope 12 // id: %2
%3 = builtin "s_to_s_checked_trunc_Int2048_Int64"(%0 : $Builtin.Int2048) : $(Builtin.Int64, Builtin.Int1), scope 12 // user: %4
%4 = tuple_extract %3 : $(Builtin.Int64, Builtin.Int1), 0, scope 12 // user: %5
%5 = struct $Int (%4 : $Builtin.Int64), scope 12 // user: %6
return %5 : $Int, scope 12 // id: %6
}
sil_scope 13 { loc "example-lazy-two.swift":2:12 parent @_TFC4main9Containers9containedSi : $@convention(method) (Int, @guaranteed Container) -> () }
sil_scope 14 { loc "example-lazy-two.swift":2:12 parent 13 }
// Container.contained.setter
sil hidden [transparent] @_TFC4main9Containers9containedSi : $@convention(method) (Int, @guaranteed Container) -> () {
// %0 // users: %4, %2
// %1 // users: %5, %3
bb0(%0 : $Int, %1 : $Container):
debug_value %0 : $Int, let, name "value", argno 1, loc "example-lazy-two.swift":2:12, scope 13 // id: %2
debug_value %1 : $Container, let, name "self", argno 2, loc "example-lazy-two.swift":2:12, scope 13 // id: %3
%4 = enum $Optional<Int>, #Optional.some!enumelt.1, %0 : $Int, scope 14 // user: %6
%5 = ref_element_addr %1 : $Container, #Container.contained.storage, scope 14 // user: %6
store %4 to %5 : $*Optional<Int>, scope 14 // id: %6
%7 = tuple (), loc "example-lazy-two.swift":2:12, scope 14 // user: %8
return %7 : $(), loc "example-lazy-two.swift":2:12, scope 14 // id: %8
}
sil_scope 15 { loc "example-lazy-two.swift":2:12 parent @_TFC4main9Containerm9containedSi : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Container) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) }
// Container.contained.materializeForSet
sil hidden [transparent] @_TFC4main9Containerm9containedSi : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Container) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
// %0 // user: %3
// %2 // user: %5
bb0(%0 : $Builtin.RawPointer, %1 : $*Builtin.UnsafeValueBuffer, %2 : $Container):
%3 = pointer_to_address %0 : $Builtin.RawPointer to [strict] $*Int, scope 15 // users: %7, %6
// function_ref Container.contained.getter
%4 = function_ref @_TFC4main9Containerg9containedSi : $@convention(method) (@guaranteed Container) -> Int, scope 15 // user: %5
%5 = apply %4(%2) : $@convention(method) (@guaranteed Container) -> Int, scope 15 // user: %6
store %5 to %3 : $*Int, scope 15 // id: %6
%7 = address_to_pointer %3 : $*Int to $Builtin.RawPointer, scope 15 // user: %11
// function_ref Container.(contained.materializeForSet).(closure #1)
%8 = function_ref @_TFFC4main9Containerm9containedSiU_T_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Container, @thick Container.Type) -> (), scope 15 // user: %9
%9 = thin_function_to_pointer %8 : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Container, @thick Container.Type) -> () to $Builtin.RawPointer, scope 15 // user: %10
%10 = enum $Optional<Builtin.RawPointer>, #Optional.some!enumelt.1, %9 : $Builtin.RawPointer, scope 15 // user: %11
%11 = tuple (%7 : $Builtin.RawPointer, %10 : $Optional<Builtin.RawPointer>), scope 15 // user: %12
return %11 : $(Builtin.RawPointer, Optional<Builtin.RawPointer>), scope 15 // id: %12
}
sil_scope 16 { loc "example-lazy-two.swift":2:12 parent @_TFFC4main9Containerm9containedSiU_T_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Container, @thick Container.Type) -> () }
sil_scope 17 { parent 16 }
// Container.(contained.materializeForSet).(closure #1)
sil hidden [transparent] @_TFFC4main9Containerm9containedSiU_T_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Container, @thick Container.Type) -> () {
// %0 // user: %5
// %2 // user: %4
bb0(%0 : $Builtin.RawPointer, %1 : $*Builtin.UnsafeValueBuffer, %2 : $*Container, %3 : $@thick Container.Type):
%4 = load %2 : $*Container, scope 17 // user: %8
%5 = pointer_to_address %0 : $Builtin.RawPointer to [strict] $*Int, scope 17 // user: %6
%6 = load %5 : $*Int, scope 17 // user: %7
%7 = enum $Optional<Int>, #Optional.some!enumelt.1, %6 : $Int, scope 17 // user: %9
%8 = ref_element_addr %4 : $Container, #Container.contained.storage, scope 17 // user: %9
store %7 to %8 : $*Optional<Int>, scope 17 // id: %9
%10 = tuple (), scope 17
%11 = tuple (), scope 17 // user: %12
return %11 : $(), scope 17 // id: %12
}
sil_scope 18 { loc "example-lazy-two.swift":3:12 parent @_TFC4main9Containerg6secondSi : $@convention(method) (@guaranteed Container) -> Int }
sil_scope 19 { loc "example-lazy-two.swift":3:12 parent 18 }
sil_scope 20 { parent 19 }
// Container.second.getter
sil hidden @_TFC4main9Containerg6secondSi : $@convention(method) (@guaranteed Container) -> Int {
// %0 // users: %35, %2, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", argno 1, loc "example-lazy-two.swift":3:12, scope 18 // id: %1
%2 = ref_element_addr %0 : $Container, #Container.second.storage, scope 19 // user: %3
%3 = load %2 : $*Optional<Int>, scope 19 // users: %29, %11, %7, %4
debug_value %3 : $Optional<Int>, let, name "tmp1", scope 19 // id: %4
%5 = integer_literal $Builtin.Int1, -1, scope 20 // user: %7
%6 = integer_literal $Builtin.Int1, 0, scope 20 // user: %7
%7 = select_enum %3 : $Optional<Int>, case #Optional.some!enumelt.1: %5, default %6 : $Builtin.Int1, scope 20 // user: %8
%8 = struct $Bool (%7 : $Builtin.Int1), scope 20 // user: %9
%9 = struct_extract %8 : $Bool, #Bool._value, scope 20 // user: %10
cond_br %9, bb1, bb7, scope 20 // id: %10
bb1: // Preds: bb0
switch_enum %3 : $Optional<Int>, case #Optional.none!enumelt: bb2, default bb6, scope 20 // id: %11
bb2: // Preds: bb1
br bb3, scope 20 // id: %12
bb3: // Preds: bb2
br bb4, scope 20 // id: %13
bb4: // Preds: bb3
br bb5, scope 20 // id: %14
bb5: // Preds: bb4
%15 = string_literal utf8 "unexpectedly found nil while unwrapping an Optional value", scope 20 // user: %17
%16 = integer_literal $Builtin.Word, 57, scope 20 // user: %19
%17 = builtin "ptrtoint_Word"(%15 : $Builtin.RawPointer) : $Builtin.Word, scope 20 // user: %19
%18 = integer_literal $Builtin.Int8, 2, scope 20 // users: %23, %19
%19 = struct $StaticString (%17 : $Builtin.Word, %16 : $Builtin.Word, %18 : $Builtin.Int8), scope 20 // user: %27
%20 = string_literal utf8 "fatal error", scope 20 // user: %22
%21 = integer_literal $Builtin.Word, 11, scope 20 // user: %23
%22 = builtin "ptrtoint_Word"(%20 : $Builtin.RawPointer) : $Builtin.Word, scope 20 // user: %23
%23 = struct $StaticString (%22 : $Builtin.Word, %21 : $Builtin.Word, %18 : $Builtin.Int8), scope 20 // user: %27
%24 = integer_literal $Builtin.Int32, 1, scope 20 // user: %25
%25 = struct $UInt32 (%24 : $Builtin.Int32), scope 20 // user: %27
// function_ref specialized _fatalErrorMessage(StaticString, StaticString, StaticString, UInt, flags : UInt32) -> Never
%26 = function_ref @_TTSfq4n_n_d_d_n___TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su5flagsVs6UInt32_Os5Never : $@convention(thin) (StaticString, StaticString, UInt32) -> Never, scope 20 // user: %27
%27 = apply %26(%23, %19, %25) : $@convention(thin) (StaticString, StaticString, UInt32) -> Never, scope 20
unreachable, scope 18 // id: %28
bb6: // Preds: bb1
%29 = unchecked_enum_data %3 : $Optional<Int>, #Optional.some!enumelt.1, scope 20 // user: %30
br bb8(%29 : $Int), scope 20 // id: %30
bb7: // Preds: bb0
%31 = integer_literal $Builtin.Int64, 1, loc "example-lazy-two.swift":3:26, scope 19 // user: %32
%32 = struct $Int (%31 : $Builtin.Int64), loc "example-lazy-two.swift":3:26, scope 19 // users: %33, %34, %37
debug_value %32 : $Int, let, name "tmp2", scope 19 // id: %33
%34 = enum $Optional<Int>, #Optional.some!enumelt.1, %32 : $Int, scope 19 // user: %36
%35 = ref_element_addr %0 : $Container, #Container.second.storage, scope 19 // user: %36
store %34 to %35 : $*Optional<Int>, scope 19 // id: %36
br bb8(%32 : $Int), scope 19 // id: %37
// %38 // user: %39
bb8(%38 : $Int): // Preds: bb7 bb6
return %38 : $Int, loc "example-lazy-two.swift":3:12, scope 19 // id: %39
}
sil_scope 21 { loc "example-lazy-two.swift":3:12 parent @_TFC4main9Containers6secondSi : $@convention(method) (Int, @guaranteed Container) -> () }
sil_scope 22 { loc "example-lazy-two.swift":3:12 parent 21 }
// Container.second.setter
sil hidden [transparent] @_TFC4main9Containers6secondSi : $@convention(method) (Int, @guaranteed Container) -> () {
// %0 // users: %4, %2
// %1 // users: %5, %3
bb0(%0 : $Int, %1 : $Container):
debug_value %0 : $Int, let, name "value", argno 1, loc "example-lazy-two.swift":3:12, scope 21 // id: %2
debug_value %1 : $Container, let, name "self", argno 2, loc "example-lazy-two.swift":3:12, scope 21 // id: %3
%4 = enum $Optional<Int>, #Optional.some!enumelt.1, %0 : $Int, scope 22 // user: %6
%5 = ref_element_addr %1 : $Container, #Container.second.storage, scope 22 // user: %6
store %4 to %5 : $*Optional<Int>, scope 22 // id: %6
%7 = tuple (), loc "example-lazy-two.swift":3:12, scope 22 // user: %8
return %7 : $(), loc "example-lazy-two.swift":3:12, scope 22 // id: %8
}
sil_scope 23 { loc "example-lazy-two.swift":3:12 parent @_TFC4main9Containerm6secondSi : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Container) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) }
// Container.second.materializeForSet
sil hidden [transparent] @_TFC4main9Containerm6secondSi : $@convention(method) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @guaranteed Container) -> (Builtin.RawPointer, Optional<Builtin.RawPointer>) {
// %0 // user: %3
// %2 // user: %5
bb0(%0 : $Builtin.RawPointer, %1 : $*Builtin.UnsafeValueBuffer, %2 : $Container):
%3 = pointer_to_address %0 : $Builtin.RawPointer to [strict] $*Int, scope 23 // users: %7, %6
// function_ref Container.second.getter
%4 = function_ref @_TFC4main9Containerg6secondSi : $@convention(method) (@guaranteed Container) -> Int, scope 23 // user: %5
%5 = apply %4(%2) : $@convention(method) (@guaranteed Container) -> Int, scope 23 // user: %6
store %5 to %3 : $*Int, scope 23 // id: %6
%7 = address_to_pointer %3 : $*Int to $Builtin.RawPointer, scope 23 // user: %11
// function_ref Container.(second.materializeForSet).(closure #1)
%8 = function_ref @_TFFC4main9Containerm6secondSiU_T_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Container, @thick Container.Type) -> (), scope 23 // user: %9
%9 = thin_function_to_pointer %8 : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Container, @thick Container.Type) -> () to $Builtin.RawPointer, scope 23 // user: %10
%10 = enum $Optional<Builtin.RawPointer>, #Optional.some!enumelt.1, %9 : $Builtin.RawPointer, scope 23 // user: %11
%11 = tuple (%7 : $Builtin.RawPointer, %10 : $Optional<Builtin.RawPointer>), scope 23 // user: %12
return %11 : $(Builtin.RawPointer, Optional<Builtin.RawPointer>), scope 23 // id: %12
}
sil_scope 24 { loc "example-lazy-two.swift":3:12 parent @_TFFC4main9Containerm6secondSiU_T_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Container, @thick Container.Type) -> () }
sil_scope 25 { parent 24 }
// Container.(second.materializeForSet).(closure #1)
sil hidden [transparent] @_TFFC4main9Containerm6secondSiU_T_ : $@convention(thin) (Builtin.RawPointer, @inout Builtin.UnsafeValueBuffer, @inout Container, @thick Container.Type) -> () {
// %0 // user: %5
// %2 // user: %4
bb0(%0 : $Builtin.RawPointer, %1 : $*Builtin.UnsafeValueBuffer, %2 : $*Container, %3 : $@thick Container.Type):
%4 = load %2 : $*Container, scope 25 // user: %8
%5 = pointer_to_address %0 : $Builtin.RawPointer to [strict] $*Int, scope 25 // user: %6
%6 = load %5 : $*Int, scope 25 // user: %7
%7 = enum $Optional<Int>, #Optional.some!enumelt.1, %6 : $Int, scope 25 // user: %9
%8 = ref_element_addr %4 : $Container, #Container.second.storage, scope 25 // user: %9
store %7 to %8 : $*Optional<Int>, scope 25 // id: %9
%10 = tuple (), scope 25
%11 = tuple (), scope 25 // user: %12
return %11 : $(), scope 25 // id: %12
}
sil_scope 26 { loc "example-lazy-two.swift":1:7 parent @_TFC4main9ContainercfT_S0_ : $@convention(method) (@owned Container) -> @owned Container }
sil_scope 27 { parent 26 }
// Container.init() -> Container
sil hidden @_TFC4main9ContainercfT_S0_ : $@convention(method) (@owned Container) -> @owned Container {
// %0 // users: %6, %13, %16, %1
bb0(%0 : $Container):
debug_value %0 : $Container, let, name "self", loc "example-lazy-two.swift":1:7, scope 26 // id: %1
%2 = alloc_stack $Optional<Int>, scope 26 // users: %3, %8, %5
inject_enum_addr %2 : $*Optional<Int>, #Optional.none!enumelt, scope 26 // id: %3
%4 = tuple (), scope 26
%5 = load %2 : $*Optional<Int>, scope 26 // user: %7
%6 = ref_element_addr %0 : $Container, #Container.contained.storage, loc "example-lazy-two.swift":2:12, scope 26 // user: %7
store %5 to %6 : $*Optional<Int>, loc "example-lazy-two.swift":2:12, scope 26 // id: %7
dealloc_stack %2 : $*Optional<Int>, loc "example-lazy-two.swift":2:12, scope 26 // id: %8
%9 = alloc_stack $Optional<Int>, scope 26 // users: %10, %15, %12
inject_enum_addr %9 : $*Optional<Int>, #Optional.none!enumelt, scope 26 // id: %10
%11 = tuple (), scope 26
%12 = load %9 : $*Optional<Int>, scope 26 // user: %14
%13 = ref_element_addr %0 : $Container, #Container.second.storage, loc "example-lazy-two.swift":3:12, scope 26 // user: %14
store %12 to %13 : $*Optional<Int>, loc "example-lazy-two.swift":3:12, scope 26 // id: %14
dealloc_stack %9 : $*Optional<Int>, loc "example-lazy-two.swift":3:12, scope 26 // id: %15
return %0 : $Container, loc "example-lazy-two.swift":1:7, scope 27 // id: %16
}
sil_scope 28 { loc "example-lazy-two.swift":1:7 parent @_TFC4main9ContainerCfT_S0_ : $@convention(method) (@thick Container.Type) -> @owned Container }
// Container.__allocating_init() -> Container
sil hidden @_TFC4main9ContainerCfT_S0_ : $@convention(method) (@thick Container.Type) -> @owned Container {
bb0(%0 : $@thick Container.Type):
%1 = alloc_ref $Container, scope 28 // user: %3
// function_ref Container.init() -> Container
%2 = function_ref @_TFC4main9ContainercfT_S0_ : $@convention(method) (@owned Container) -> @owned Container, scope 28 // user: %3
%3 = apply %2(%1) : $@convention(method) (@owned Container) -> @owned Container, scope 28 // user: %4
return %3 : $Container, scope 28 // id: %4
}
sil_scope 29 { parent @_TFSqCfT10nilLiteralT__GSqx_ : $@convention(method) <τ_0_0> (@thin Optional<τ_0_0>.Type) -> @out Optional<τ_0_0> }
// Optional.init(nilLiteral : ()) -> A?
sil public_external [transparent] [fragile] @_TFSqCfT10nilLiteralT__GSqx_ : $@convention(method) <Wrapped> (@thin Optional<Wrapped>.Type) -> @out Optional<Wrapped> {
// %0 // user: %2
bb0(%0 : $*Optional<Wrapped>, %1 : $@thin Optional<Wrapped>.Type):
inject_enum_addr %0 : $*Optional<Wrapped>, #Optional.none!enumelt, scope 29 // id: %2
%3 = tuple (), scope 29 // user: %4
return %3 : $(), scope 29 // id: %4
}
// globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4
sil private_external [fragile] @globalinit_33_FD9A49A256BEB6AF7C48013347ADC3BA_func4 : $@convention(thin) () -> ()
// specialized _fatalErrorMessage(StaticString, StaticString, StaticString, UInt, flags : UInt32) -> Never
sil [fragile] [noinline] [_semantics "arc.programtermination_point"] [_semantics "stdlib_binary_only"] @_TTSfq4n_n_d_d_n___TFs18_fatalErrorMessageFTVs12StaticStringS_S_Su5flagsVs6UInt32_Os5Never : $@convention(thin) (StaticString, StaticString, UInt32) -> Never
sil_vtable Container {
#Container.deinit!deallocator: _TFC4main9ContainerD // Container.__deallocating_deinit
#Container.contained!getter.1: _TFC4main9Containerg9containedSi // Container.contained.getter
#Container.contained!setter.1: _TFC4main9Containers9containedSi // Container.contained.setter
#Container.contained!materializeForSet.1: _TFC4main9Containerm9containedSi // Container.contained.materializeForSet
#Container.second!getter.1: _TFC4main9Containerg6secondSi // Container.second.getter
#Container.second!setter.1: _TFC4main9Containers6secondSi // Container.second.setter
#Container.second!materializeForSet.1: _TFC4main9Containerm6secondSi // Container.second.materializeForSet
#Container.init!initializer.1: _TFC4main9ContainercfT_S0_ // Container.init() -> Container
}
class Container {
lazy var contained: Int = 0
lazy var second: Int = 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment