Commit Graph

19 Commits

Author SHA1 Message Date
Erik Eckstein
18063707b5 Optimizer: enable complete OSSA lifetimes throughout the pass pipeline
This new OSSA invariant simplifies many optimizations because they don't have to take care of the corner case of incomplete lifetimes in dead-end blocks.

The implementation basically consists of these changes:
* add the lifetime completion utility
* add a flag in SILFunction which tells optimization that they need to run the lifetime completion utility
* let all optimizations complete lifetimes if necessary
* enable the ownership verifier to check complete lifetimes
2026-01-22 17:41:48 +01:00
Michael Gottesman
2e138024a8 [variable-name-utils] Look through convert function when finding names. 2024-08-07 13:10:54 -07:00
Nate Chandler
a75bd893b9 [Test] Underscored variable_name_inference.
Use underscores rather than hyphens so that text editors understand the
name as a single word.
2024-07-25 13:52:21 -07:00
Michael Gottesman
b5aa2fec31 [siloptimizer] Teach VariableNameInference how to look through convert_escape_to_no_escape.
This was causing us to emit old style diagnostics in certain cases.

Just doing a walk through of the diagnostics and fixing issues while I
am here sprucing up sending diagnostics.

rdar://130915737
2024-07-01 14:37:11 -07:00
Michael Gottesman
baec06ed23 [variable-name-inference] Add support for handling EndInitLetRefInst. 2024-06-24 18:16:11 -07:00
Michael Gottesman
b780ff6696 [sending] Begin parsing 'sending' while still accepting 'transferring'.
A few things:

1. Internally except for in the parser and the clang importer, we only represent
'sending'. This means that it will be easy to remove 'transferring' once enough
time has passed.

2. I included a warning that suggested to the user to change 'transferring' ->
'sending'.

3. I duplicated the parsing diagnostics for 'sending' so both will still get
different sets of diagnostics for parsing issues... but anywhere below parsing,
I have just changed 'transferring' to 'sending' since transferring isn't
represented at those lower levels.

4. Since SendingArgsAndResults is always enabled when TransferringArgsAndResults
is enabled (NOTE not vis-a-versa), we know that we can always parse sending. So
we import "transferring" as "sending". This means that even if one marks a
function with "transferring", the compiler will guard it behind a
SendingArgsAndResults -D flag and in the imported header print out sending.

rdar://128216574
2024-05-16 21:43:50 -07:00
Michael Gottesman
20c24293e5 [region-isolation] Do not look through begin_borrow or move_value if they are marked as a var_decl.
The reason why we do this is that we want to treat this as a separate value from
their operand since they are the result of defining a new value.

This has a few nice side-effects, one of which is that if a let results in just
a begin_borrow [var_decl], we emit names for it.

I also did a little work around helping variable name utils to lookup names from
applies that are fed into a {move_value,begin_borrow} [var_decl] which then has
the debug_value we are searching for.
2024-04-11 15:41:18 -07:00
Emil Pedersen
efa09088ac Revert "[DebugInfo][SIL] Introduce the 'implicit' attribute for debug variable"
This reverts commit e63632fda8.

rdar://125939953
2024-04-04 17:23:32 -07:00
Michael Gottesman
ce27305279 [sil] Teach variable name utils how to handle init_existential_addr temporaries.
Just eliminating more cases of the typed errors in favor of named errors.
2024-03-29 18:48:04 -07:00
Michael Gottesman
29e3069a50 [region-isolation] Teach variable name utils how to handle more tuple patterns.
Just slicing off from a larger patch.
2024-03-19 13:19:09 -07:00
Michael Gottesman
8b899b8f71 [region-isolation] Teach variable_name_inference how to infer through store_borrow initialized variables.
This eliminates a bunch of cases where we couldn't infer the name of a variable
and used the type based diagnostic.

It also eliminates an 'unknown' case for move checking.
2024-03-19 13:19:09 -07:00
Michael Gottesman
f2b5b86e2e [region-isolation] Learn how to find variable names around phi arguments.
With this, the only remaining "task or actor isolated" error is due to changes I
need to land around async let.
2024-03-12 13:43:02 -07:00
Michael Gottesman
ec81ecdbe6 [region-isolation] Eliminate more of the 'task or actor isolated value cannot be transferred' warning.
Specifically, I had to teach the variable name inferrer how to infer through
unchecked_enum_data and unchecked_take_enum_data_addr.
2024-03-12 12:26:55 -07:00
Michael Gottesman
d8b2631f5f [region-isolation] Make fields of global actor guarded types that are non-Sendable be considered as actor isolated.
rdar://123488540
2024-03-08 12:42:15 -08:00
Michael Gottesman
e21c0a6c39 [sil] Teach variable name inference how to look through more instructions. 2024-02-22 13:50:06 -08:00
Michael Gottesman
e1ecd8b54d [sil] Teach VariableNameUtils how to look through function conversion thunk patterns. 2024-02-22 13:50:06 -08:00
Michael Gottesman
9154082d12 [sil] Teach VariableNameInferrer how to look through /all/ accessors. 2024-02-22 13:50:06 -08:00
Michael Gottesman
d4f727adde [region-isolation] Add support for identifying names when a temporary is initialized with a store. 2024-02-06 16:49:30 -08:00
Michael Gottesman
2010579b02 [sil] Add basic test support for variable name inference. 2024-02-06 15:21:11 -08:00