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"
6363
6464 context. erase ( instruction: allocInst)
6565 context. erase ( instruction: storeToGlobal)
66+ context. removeTriviallyDeadInstructionsIgnoringDebugUses ( in: function)
6667}
6768
6869/// 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 {
161161 }
162162}
163163
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+
164174// CHECK-LABEL: sil_global private @$s4test9createArrSaySiSgGyFTv_ : $_ContiguousArrayStorage<Optional<Int>> = {
165175@inline ( never)
166176func createArr( ) -> [ Int ? ] {
@@ -234,6 +244,8 @@ struct Main {
234244 print ( " stringGen2: \( getStringGen ( sg2) ) " )
235245 // CHECK-OUTPUT: stringGen3: str
236246 print ( " stringGen3: \( getStringGen ( sg3) ) " )
247+ // CHECK-OUTPUT: optSuccess: Optional(test.R.success(27))
248+ print ( " optSuccess: " , optSuccess as Any )
237249 }
238250}
239251
You can’t perform that action at this time.
0 commit comments