mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
For example the pattern:
```
%e = load %1 : SomeEnum
switch_enum %e
```
The switch_enum_addr should reuse the load's address operand instead of
creating a new location for the SSA value of %e.
While we are there also don't create a new stack location for extracting payload
in a switch_enum_addr case target basic block if that extracted payload is not
used. That is if the basic block arguments in all switch target blocks are
unused in the switch_enum version.
```
switch_enum %enum, case #Optional.some!enumelt: bb1,
case #Optional.none!enumelt: bb2
bb2(%payload : $Payload):
// unused %payload value
```
rdar://156602951
178 KiB
178 KiB