Skip to content

Instantly share code, notes, and snippets.

@zoecarver
Created March 18, 2020 18:26
Show Gist options
  • Save zoecarver/c7626b6f3b935a3879e04dec74e3ff93 to your computer and use it in GitHub Desktop.
Save zoecarver/c7626b6f3b935a3879e04dec74e3ff93 to your computer and use it in GitHub Desktop.
sil [transparent] @closure : $@convention(thin) (Builtin.Int32) -> Builtin.Int32
sil hidden [ossa] @test : $@convention(thin) (Builtin.Int1) -> () {
// %0 // user: %6
bb0(%0 : $Builtin.Int1):
%1 = alloc_box ${ var @callee_guaranteed (Builtin.Int32) -> Builtin.Int32 }, var, name "c" // users: %19, %2
%2 = project_box %1 : ${ var @callee_guaranteed (Builtin.Int32) -> Builtin.Int32 }, 0 // users: %14, %7, %5
// function_ref closure #1 in test(x:)
%3 = function_ref @closure : $@convention(thin) (Builtin.Int32) -> Builtin.Int32 // user: %4
%4 = thin_to_thick_function %3 : $@convention(thin) (Builtin.Int32) -> Builtin.Int32 to $@callee_guaranteed (Builtin.Int32) -> Builtin.Int32 // user: %5
store %4 to [init] %2 : $*@callee_guaranteed (Builtin.Int32) -> Builtin.Int32 // id: %5
cond_br %0, bb1, bb2 // id: %6
bb1: // Preds: bb0
%7 = begin_access [read] [unknown] %2 : $*@callee_guaranteed (Builtin.Int32) -> Builtin.Int32 // users: %9, %8
%8 = load [copy] %7 : $*@callee_guaranteed (Builtin.Int32) -> Builtin.Int32 // users: %10, %13
end_access %7 : $*@callee_guaranteed (Builtin.Int32) -> Builtin.Int32 // id: %9
destroy_value %8 : $@callee_guaranteed (Builtin.Int32) -> Builtin.Int32 // id: %13
br bb3 // id: %17
bb2: // Preds: bb0
br bb3 // id: %18
bb3: // Preds: bb2 bb1
destroy_value %1 : ${ var @callee_guaranteed (Builtin.Int32) -> Builtin.Int32 } // id: %19
%20 = tuple () // user: %21
return %20 : $() // id: %21
} // end sil function 'test'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment