blob: 688d2ebe60cbfe2e69d7d23de04d2b36ae27374c [file] [log] [blame]
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil %s | %FileCheck %s
// Generated from
// var x : Int32 = 2
// public func f() -> Int32 { return x }
// with swiftc -O -parse-as-library -emit-sil
import Builtin
import Swift
// CHECK: sil_global private @globalinit_token0 : $Builtin.Word
sil_global private @globalinit_token0 : $Builtin.Word
// CHECK: sil_global @_Tv2ch1xSi : $Int32, @globalinit_func0 : $@convention(thin) () -> ()
sil_global @_Tv2ch1xSi : $Int32, @globalinit_func0 : $@convention(thin) () -> ()
// CHECK-LABEL: sil private @globalinit_func0 : $@convention(thin) () -> () {
sil private @globalinit_func0 : $@convention(thin) () -> () {
bb0:
%0 = global_addr @_Tv2ch1xSi : $*Int32
%1 = integer_literal $Builtin.Int32, 2
%2 = struct $Int32 (%1 : $Builtin.Int32)
store %2 to %0 : $*Int32
%4 = tuple ()
return %4 : $()
}
// CHECK-LABEL: sil [global_init] @_TF2cha1xSi : $@convention(thin) () -> Builtin.RawPointer {
sil [global_init] @_TF2cha1xSi : $@convention(thin) () -> Builtin.RawPointer {
bb0:
%0 = global_addr @_Tv2ch1xSi : $*Int32
%1 = address_to_pointer %0 : $*Int32 to $Builtin.RawPointer
return %1 : $Builtin.RawPointer
}
// CHECK-LABEL: sil @_TF2ch1fFT_Si : $@convention(thin) () -> Int32 {
sil @_TF2ch1fFT_Si : $@convention(thin) () -> Int32 {
bb0:
%0 = global_addr @_Tv2ch1xSi : $*Int32
%1 = load %0 : $*Int32
return %1 : $Int32
}