zig/test/behavior
mlugg 644041b3a4 Sema: refactor detection of comptime-known consts
This was previously implemented by analyzing the AIR prior to the ZIR
`make_ptr_const` instruction. This solution was highly delicate, and in
particular broke down whenever there was a second `alloc` between the
`store` and `alloc` instructions, which is especially common in
destructure statements.

Sema now uses a different strategy to detect whether a `const` is
comptime-known. When the `alloc` is created, Sema begins tracking all
pointers and stores which refer to that allocation in temporary local
state. If any store is not comptime-known or has a higher runtime index
than the allocation, the allocation is marked as being runtime-known.
When we reach the `make_ptr_const` instruction, if the allocation is not
marked as runtime-known, it must be comptime-known. Sema will use the
set of `store` instructions to re-initialize the value in comptime
memory. We optimize for the common case of a single `store` instruction
by not creating a comptime alloc in this case, instead directly plucking
the result value from the instruction.

Resolves: #16083
2023-09-23 13:51:18 +01:00
..
2023-06-25 14:51:03 -07:00
2023-09-19 09:37:53 -07:00
2023-07-31 03:49:21 -04:00
2023-05-20 17:30:22 +02:00
2023-07-26 19:02:02 -07:00
2023-05-20 17:30:22 +02:00
2023-07-31 01:58:10 -04:00
2023-07-26 22:19:30 -07:00
2023-06-27 19:57:23 -04:00
2022-01-07 00:06:06 -05:00
2023-08-09 05:46:44 -04:00
2023-05-20 18:43:26 +03:30
2023-05-20 17:30:22 +02:00
2023-05-11 20:31:52 +02:00
2023-05-20 17:30:22 +02:00
2023-08-30 16:50:30 -04:00
2023-05-11 20:31:52 +02:00