mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Delay the emission of SIL global variables that aren't externally visible until they are actually used. This is the same lazy emission approach that we use for a number of other entities, such as SIL functions. Part of rdar://158363967.
20 lines
525 B
Plaintext
20 lines
525 B
Plaintext
// RUN: %target-swift-frontend -module-name main %s -emit-ir -o - | %FileCheck %s
|
|
|
|
sil_stage canonical
|
|
|
|
import Builtin
|
|
import Swift
|
|
|
|
struct T {
|
|
@_hasStorage var a: Builtin.Int1 { get set }
|
|
@_hasStorage var b: Builtin.Int32 { get set }
|
|
}
|
|
|
|
// CHECK: @global = hidden global %T4main1TV <{ i1 false, [3 x i8] undef, i32 0 }>, align 4
|
|
sil_global hidden [used] @global : $T = {
|
|
%2 = integer_literal $Builtin.Int1, 0
|
|
%3 = integer_literal $Builtin.Int32, 0
|
|
%initval = struct $T (%2 : $Builtin.Int1, %3 : $Builtin.Int32)
|
|
}
|
|
|