Meghana Gupta
4fe0429705
Merge pull request #71880 from meg-gupta/ossasilcombine
...
Add silcombines for destructure_tuple and destructure_struct
2024-02-26 14:01:05 -08:00
Meghana Gupta
7508a90af0
Enable destructure_struct/destructure_tuple simplifications in silcombine
2024-02-26 10:58:08 -08:00
Andrew Trick
e3198ed38e
Fix AccessUtils.swift to use the project_box reference root.
2024-02-26 00:20:46 -08:00
Andrew Trick
7574c1fede
Fix AccessUtils Value.referenceRoot to handle ForwardingInstructions.
...
This fixes all analyses that use AccessUtils in the presence of new
forwarding instructions. This is also needed for consistency with the
C++ source base. And for general sanity.
Utilities that walk the use-def chain should never hard-code a list of
opcodes that happened to work with some specific pass. Passes should
never assume that a basic SIL utility handles specific SIL operations
a certain way. Instead, the utility needs to be defined in terms of
SIL semantics. In this case, the utility is supposed to handle all
instructions that semantically forward ownership of a reference.
2024-02-26 00:20:46 -08:00
Andrew Trick
56126e9db9
Fix LetPropertyLowering to correctly find mark_uninitialized uses.
2024-02-26 00:20:46 -08:00
Andrew Trick
a7e4e900c4
Fix LifetimeDependenceUtils to use OwnershipTransitionInstruction
2024-02-26 00:20:46 -08:00
Andrew Trick
760fa24d1e
Add ForwardingInstruction.preservesIdentity.
...
Mirror isIdentityPreservingRefCase.
I don't know why this does not apply to boxes and existentials, but am convervatively staying consistent with the
current behavior.
2024-02-26 00:20:46 -08:00
Andrew Trick
0752ea5824
Add OwnershipTransitionInstruction.
...
These instructions carry lifetime dependence from a single operand to a single result. They are not forwarding
instructions because we use them to indicate the boundaries of a forwarded lifetime.
2024-02-26 00:12:07 -08:00
Andrew Trick
d7205edd70
Code formatting cleanup related to CopyingInstruction
2024-02-26 00:12:07 -08:00
Andrew Trick
f9a26d42d3
Make MoveOnlyWrapperToCopyableBoxInst a ConversionInstruction.
...
This appears to be an obvious oversight.
2024-02-25 10:29:15 -08:00
Andrew Trick
0b81392dff
Code formatting cleanup related to ForwardingInstruction.
2024-02-25 10:29:15 -08:00
Andrew Trick
5fc50a0092
AddressUtils: refactor the findSingleInitializer API.
2024-02-25 10:29:15 -08:00
Andrew Trick
a3cbc28078
SwiftCompilerSources: Add enum BeginAccess.AccessKind
...
So we can switch over it.
2024-02-25 10:22:06 -08:00
eeckstein
d1961e1126
Merge pull request #71808 from eeckstein/global_async_function_pointers
...
Support statically initialized global async function pointers
2024-02-22 16:44:38 +01:00
Erik Eckstein
9aff04a65a
Support statically initialized global async function pointers
...
rdar://123327436
2024-02-22 09:38:18 +01:00
Erik Eckstein
a13a6e0bf7
SIL: verify forwarding conformances
...
Verify that the C++ view of forwarding instructions agrees with the swift ForwardInstruction conformances.
2024-02-22 07:12:11 +01:00
Erik Eckstein
c805f6cbd8
SwiftCompilerSources: refactor and fix forwarding instructions
...
* add ForwardingInstruction conformances to missing forwarding instruction classes
* move all the forwarding instruction conformance definitions into ForwardingInstructions.swift
* remove the default implementations of the requirements, so that every instruction needs to specify them
2024-02-22 07:12:11 +01:00
Erik Eckstein
68cc6c8780
SwiftCompilerSources: add all missing instruction classes
...
And require that all new instructions must be added and registered in SwiftCompilerSources as well.
2024-02-22 07:12:10 +01:00
Erik Eckstein
aadb0598c9
SIL: remove the var operands requirement from UnaryInstruction
...
It's not needed because UnaryInstruction is "derived" from Instruction which has this property.
2024-02-22 07:12:10 +01:00
Erik Eckstein
71fcae7fe8
SwiftCompilerSources: add the ability to implement SIL verification in swift
2024-02-22 07:12:10 +01:00
Meghana Gupta
12ac8042ab
Handle YieldInst in LifetimeDependenceUtils
2024-02-19 15:28:04 -08:00
Andrew Trick
41043948c1
LifetimeDependenceDiagnostics: enable mutably borrowed lifetimes.
...
This allows basic prototyping. A separate analysis will ensure no
mutation of the original value during the borrow.
2024-02-15 02:39:34 -08:00
Andrew Trick
68037faa61
LifetimeDependenceScopeFixup: handle nested access
...
After extending access scopes, rewrite the mark_depenendence to be on
the outermost scope.
2024-02-13 22:22:28 -08:00
Andrew Trick
f0b04004ff
LifetimeDepenenceUtils; improve VariableIntroducerUseDefWalker
...
Stop at formal access to a mutable variable.
2024-02-13 20:57:02 -08:00
Andrew Trick
bc0f60afc9
LifetimeDependenceDiagnostics: cleanup. remove unused code.
2024-02-13 20:57:02 -08:00
Meghana Gupta
75bd5b08dd
Add LifetimeDependenceScopeFixup pass
2024-02-13 16:52:01 -08:00
Meghana Gupta
14578db701
Bridge createEndAccess
2024-02-13 00:12:23 -08:00
Andrew Trick
c440cca939
Merge pull request #71570 from atrick/lifetime-inherit
...
LifetimeDependenceInsertion: do not emit inherited dependencies.
2024-02-12 23:02:14 -08:00
eeckstein
77cd7b5e87
Merge pull request #71554 from eeckstein/fix-escape-utils
...
EscapeUtils: fix escape result in case an address is stored
2024-02-13 07:13:51 +01:00
Andrew Trick
ecf2e36717
LifetimeDependenceDiagnostics: FIXME for @_unsafeNonEscapableResult
...
Reminder to add a builtin to reliably enforce this unsafe attribute.
2024-02-12 20:05:25 -08:00
Andrew Trick
1cdf9d56ac
LifetimeDefUseWalker handles inherited dependencies.
...
This is needed when we don't insert mark_dependence.
2024-02-12 20:05:24 -08:00
Andrew Trick
ade2ed6ddb
LifetimeDependenceInsertion: do not emit inherited dependencies.
...
These were always redundant. And there is no way to emit them
correctly for valid OSA when the original dependence scope is in the
caller.
NFC without:
-enable-experimental-feature NonescapableTypes
-enable-lifetime-dependence-diagnostics
2024-02-12 20:05:21 -08:00
Andrew Trick
2e7c29cdf5
Restrict findSingleInitializer @out arguments.
...
The client should handle @in/@inout arguments differently.
2024-02-12 20:03:38 -08:00
Andrew Trick
fcb8612c18
Format SingleInlineArray for use in lit tests.
2024-02-12 20:03:38 -08:00
Andrew Trick
c4eab6a54a
Merge pull request #71266 from atrick/lifetime-insertion
...
Add the LifetimeDependenceInsertion pass.
2024-02-12 13:07:03 -08:00
nate-chandler
1713693703
Merge pull request #71558 from nate-chandler/test/20240212/1/troubleshoot-test-note
...
[Test] Added troubleshooting note.
2024-02-12 13:06:20 -08:00
Nate Chandler
f9ee089c04
[Test] Added troubleshooting note.
2024-02-12 10:23:13 -08:00
Andrew Trick
8c092911ef
Add the LifetimeDependenceInsertion pass.
...
Insert mark_dependence [nonescaping] markers at every lifetime
introducer that produces a lifetime-dependent value.
2024-02-12 09:57:14 -08:00
Andrew Trick
274c47877f
LifetimeDepenenceDiagnostics improvements
...
Better handling of @_unsafeNonescapableResult
Improve diagnostic clarity.
2024-02-12 09:57:14 -08:00
Andrew Trick
af39b0fb1f
LifetimeDependenceUtils improvements
...
Improve noescape function handling. Use the mayEscape API.
Improve handling of @_unsafeNonescapableResult.
Improve handling of initialized scopes. Use findSingleInitializer.
2024-02-12 09:57:14 -08:00
Andrew Trick
ac457abab9
LifetimeDependenceUseDefWalker: track the owner of the value.
2024-02-12 09:57:14 -08:00
Andrew Trick
e9762432d5
Improve Operand.isAddressInitialization to handle indirect results.
2024-02-12 09:57:14 -08:00
Andrew Trick
b08f2dedf1
Add AccessBase.findSingleInitializer
2024-02-12 09:57:14 -08:00
Andrew Trick
63413916a1
LifetimeDependenceDiagnostics; handle @_unsafeNonescapableResult.
2024-02-12 09:57:14 -08:00
Andrew Trick
8b24382494
SwiftCompilerSources: cleanup and extend ArgumentConventions
...
Provide APIs needed by lifetime dependence diagnostics, namely LifetimeDependenceConvention.
Reorganize the APIs so it's easy to find related functionality which
API is responsible for which functionality.
Remove the originalFunctionConvention complexity. It is no longer
needed for lifetime dependence inference, and generally should be
avoided in SIL.
Add some placeholder FIXMEs because this not a good PR in which to
change existing functionality.
2024-02-12 09:57:14 -08:00
Andrew Trick
28b60e051d
Bridge SILFunctionType LifetimeDependenceInfo
2024-02-12 09:57:14 -08:00
Andrew Trick
03bda631f1
AccessUtils: comment typo
2024-02-12 09:57:14 -08:00
Andrew Trick
15fef6868c
BorrowUtils: add a comment
2024-02-12 09:57:14 -08:00
Andrew Trick
d0ac09493a
Bridge MarkDependence.resolveToNonEscaping
2024-02-12 09:57:14 -08:00
Andrew Trick
f713587aa5
Fix OSSA support for mark_dependence [nonescaping]
...
Handle escapes to function results.
2024-02-12 09:57:14 -08:00