mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Remove casts between arrays of the same type.
```
%1 = function_ref @_arrayConditionalCast : (@guaranteed Array<Int>) -> @owned Optional<Array<Int>>
%2 = apply %1(%0) : (@guaranteed Array<Int>) -> @owned Optional<Array<Int>>
```
->
```
%1 = copy_value %0
%2 = enum $Optional<Array<Int>>, #Optional.some!enumelt, %1
```
This can be a result of specialization, e.g.
```
func foo<T>(from: [T]) -> [Int]? {
return from as? [Int]
}
func bar(a: [Int]) -> [Int]? {
return foo(from: a)
}
```
rdar://139632757
9.8 KiB
9.8 KiB