Files
swift-mirror/unittests/SILOptimizer
Michael Gottesman 85cc3fe80e [rbi] Distinguish direct vs indirect assignment to preserve overwritten memory regions
Split the `Assign` partition operation into `AssignDirect` and `AssignIndirect`
to properly handle the case where a value in memory is overwritten.

Previously, when a store instruction overwrote a value in memory (e.g.,
`store %new to [assign] %addr`), we would simply update %addr's region to
match %new's region. This caused us to lose information about the original
value that was in %addr, which could include actor or task isolation info.

For example:
  %addr = alloc_stack
  store %task_local to [init] %addr   // %addr's region is task-isolated
  store %new_value to [assign] %addr  // Previously: lost task isolation!

Now, `AssignIndirect` creates a new representative value (identified by the
store's destination operand) for the overwritten value and merges it into
the destination's region before reassigning. This preserves the region's
isolation properties.

`AssignDirect` continues to be used for direct results where the SSA value
itself is new (e.g., struct_extract results, pack_element_get addresses).

The actual implementation change for AssignIndirect will come in a follow-up
commit. This commit only refactors code in preparation for that.
2026-01-22 06:06:18 -08:00
..
2023-10-26 07:43:30 -07:00