swift
864c1434 - Devirtualizer: fix a crash due to a not supported bitcast of ABI compatible types

Commit
1 year ago
Devirtualizer: fix a crash due to a not supported bitcast of ABI compatible types When devirtualizing witness method calls, it can happen that we need a cast between ABI compatible return types. We were missing supporting type casts between nominal types which are ABI compatible. This comes from whole-module reasoning of protocol conformances. If a protocol only has a single conformance where the associated type (`ID`) is some concrete type (e.g. `Int`), then the devirtualizer knows that `p.get()` can only return an `Int`: ``` public struct X2<ID> { let p: any P2<ID> public func testit(i: ID, x: ID) -> S2<ID> { return p.get(x: x) } } ``` and after devirtualizing the `get` function, its result must be cast from `Int` to `ID`. The `layoutIsTypeDependent` utility is basically only used here to assert that this cast can only happen between layout compatible types. rdar://129004015
Author
Committer
Parents
Loading