mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Look through `upcast` and `init_existential_ref` instructions and replace the operand of this cast instruction with the original value. For example: ``` %2 = upcast %1 : $Derived to $Base %3 = init_existential_ref %2 : $Base : $Base, $AnyObject checked_cast_br %3 : $AnyObject to Derived, bb1, bb2 ``` This makes it more likely that the cast can be constant folded because the source operand's type is more accurate. In the example above, the cast reduces to ``` checked_cast_br %1 : $Derived to Derived, bb1, bb2 ``` which can be trivially folded to always-succeeds. Found while looking at `_SwiftDeferredNSDictionary.bridgeValues()`