Files
swift-mirror/lib/IRGen/LoadableByAddress.cpp
Arnold Schwaighofer 1e8e3b82df LargeTypesReg2Mem: Peephole load followed by single user to reuse the load's address
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
2025-08-07 07:21:51 -07:00

178 KiB