File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
SwiftCompilerSources/Sources/Optimizer/FunctionPasses Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ let initializeStaticGlobalsPass = FunctionPass(name: "initialize-static-globals"
63
63
64
64
context. erase ( instruction: allocInst)
65
65
context. erase ( instruction: storeToGlobal)
66
+ context. removeTriviallyDeadInstructionsIgnoringDebugUses ( in: function)
66
67
}
67
68
68
69
/// Analyses the global initializer function and returns the `alloc_global` and `store`
Original file line number Diff line number Diff line change @@ -161,6 +161,16 @@ func getStringGen(_ s: StringGen) -> String {
161
161
}
162
162
}
163
163
164
+ public enum R {
165
+ case success( Int )
166
+ case failure( Error )
167
+ }
168
+
169
+ public let success : R = . success( 27 )
170
+
171
+ // CHECK-LABEL: sil_global hidden @$s4test10optSuccessAA1ROSgvp : $Optional<R> = {
172
+ var optSuccess : R ? = success
173
+
164
174
// CHECK-LABEL: sil_global private @$s4test9createArrSaySiSgGyFTv_ : $_ContiguousArrayStorage<Optional<Int>> = {
165
175
@inline ( never)
166
176
func createArr( ) -> [ Int ? ] {
@@ -234,6 +244,8 @@ struct Main {
234
244
print ( " stringGen2: \( getStringGen ( sg2) ) " )
235
245
// CHECK-OUTPUT: stringGen3: str
236
246
print ( " stringGen3: \( getStringGen ( sg3) ) " )
247
+ // CHECK-OUTPUT: optSuccess: Optional(test.R.success(27))
248
+ print ( " optSuccess: " , optSuccess as Any )
237
249
}
238
250
}
239
251
You can’t perform that action at this time.
0 commit comments