Files
swift-mirror/test/SIL/Serialization/globals.sil
Slava Pestov 53bfc767a3 SIL: Track target formal type for casts
SIL type lowering erases DynamicSelfType, so we generate
incorrect code when casting to DynamicSelfType. Fixing this
requires a fair amount of plumbing, but most of the
changes are mechanical.

Note that the textual SIL syntax for casts has changed
slightly; the target type is now a formal type without a '$',
not a SIL type.

Also, the unconditional_checked_cast_value and
checked_cast_value_br instructions now take the _source_
formal type as well, just like the *_addr forms they are
intended to replace.
2019-11-20 21:30:28 -05:00

27 lines
745 B
Plaintext

// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend %s -emit-module -o %t/tmp.swiftmodule
// RUN: %target-sil-opt %t/tmp.swiftmodule -disable-sil-linking | %FileCheck %s
sil_stage canonical
import Swift
// CHECK-NOT: sil_global hidden @hidden_global_unused
sil_global hidden @hidden_global_unused : $Int
// CHECK-NOT: sil_global @public_global_unused
sil_global @public_global_unused : $Int
// CHECK: sil_global @public_global_used
sil_global @public_global_used : $Int
// CHECK: sil_global [serialized] @serialized_global
sil_global [serialized] @serialized_global : $Int
sil [serialized] @uses_public_global : $@convention(thin) () -> () {
bb0:
%1 = global_addr @public_global_used : $*Int
%2 = tuple ()
return %2 : $()
}