Commit Graph

4 Commits

Author SHA1 Message Date
Michael Gottesman
6058b1d9bd [silgen] Change SILGen to emit ignored_user for emitIgnoredExpr and black hole initialization. 2025-01-22 21:12:36 -08:00
Arnold Schwaighofer
3ab4484145 SILOptimizer: Add destructure peepholes
```
 (%7, ...) = destructure_tuple %6 : $(A, ...)
 tuple_addr_constructor [assign] %9 : $*(A, ...) with (%7 : $A, ...)
   =>
 store [assign] %6 to %9
```

and

```
 (tuple (destructure_tuple %t))
  => %t
```
2024-10-31 09:47:27 -07:00
Michael Gottesman
b1f69030fc [region-isolation] When assigning RValues into memory, use tuple_addr_constructor instead of doing it in pieces.
I also included changes to the rest of the SIL optimizer pipeline to ensure that
the part of the optimizer pipeline before we lower tuple_addr_constructor (which
is right after we run TransferNonSendable) work as before.

The reason why I am doing this is that this ensures that diagnostic passes can
tell the difference in between:

```
x = (a, b, c)
```

and

```
x.0 = a
x.1 = b
x.2 = c
```

This is important for things like TransferNonSendable where assigning over the
entire tuple element is treated differently from if one were to initialize it in
pieces using projections.

rdar://117880194
2023-11-07 15:38:33 -08:00
Michael Gottesman
d2b5bc33a1 [sil-optimizer] Add a small pass that runs after TransferNonSendable and eliminates tuple addr constructor.
This will limit the number of passes that need to be updated to handle
tuple_addr_constructor.
2023-11-06 15:47:15 -08:00