Commit Graph

1 Commits

Author SHA1 Message Date
Slava Pestov
b2e2b02a71 IRGen: Fix out-of-order task_dealloc with parameter pack metadata
We deallocate an instruction's packs at points where no further
control flow path uses the value. In the case of an alloc_stack,
this will be right after the dealloc_stack. Thus, if alloc_stack
allocates some packs to build type metadata for a tuple type
that contains a pack, and then proceeds to allocate a value
large enough to hold the tuple, we will free the second allocation
first, before we free the pack, as expected.

However, after stack allocating the value, alloc_stack does
some further work to emit debug info. This could result in
emission of additional metadata packs.

Split up the debug info emission into two parts; the first we do
before we perform the stack allocation, the rest we do after.

- Fixes https://github.com/swiftlang/swift/issues/67702.
- Fixes rdar://problem/141363236.
2025-05-15 12:22:21 -04:00