Commit Graph

2410 Commits

Author SHA1 Message Date
Joe Groff
2170b4e725 Merge pull request #71489 from jckarter/borrowing-switch-8
MoveOnlyAddressUtils: Fixes for borrowing switch over address-only types.
2024-02-13 07:51:40 -08:00
John McCall
d5142668f4 SIL and IRGen support for @isolated(any). SILGen to come. 2024-02-13 03:04:13 -05:00
Pavel Yaskevich
db020c1486 Merge pull request #71435 from xedin/fix-need-for-adhoc-distributed-requirements
[Distributed] Re-implement ad-hoc requirements into dynamic witness table lookup for `SerializationRequirement` conformance
2024-02-13 00:02:05 -08:00
Doug Gregor
3edbb06632 [SILGen] Don't peephole closures with abstraction differences in the thrown error
The prolog and epilog code in SILGen is not set up to deal with
abstraction differences in the thrown error type of closures, so disable
the peephole optimization for closure literals.

Fixes https://github.com/apple/swift/issues/71401 / rdar://122366566,
which I've stared at for waaaaay too many hours.
2024-02-12 23:15:07 -08:00
Joe Groff
0365c6abba MoveOnlyAddressUtils: Fixes for borrowing switch over address-only types.
Relax some existing pattern matches and add some unhandled instructions to the
walkers so that borrowing switches over address-only enums are properly analyzed
for incorrect consumption. Add a `[strict]` flag to `mark_unresolved_move_only_value`
to indicate a borrow access that should remain a borrow access even if the subject
is later stack-promoted from a box.
2024-02-12 20:20:50 -08:00
Allan Shortlidge
b96812513c Merge pull request #71561 from tshortli/warnings
NFC: Address some warnings
2024-02-12 14:59:27 -08:00
Pavel Yaskevich
1909b12370 [SIL] Distributed: Remove logic related to ad-hoc requirements from SILFunction
Ad-hoc requirements are now obsolete by making `remoteCall`,
`record{Argument, ReturnType}`, `decodeNextArgument` protocols
requirements and injecting witness tables for `SerializationRequirement`
conformances during IRGen.
2024-02-12 14:26:30 -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
Allan Shortlidge
91f14e32e7 NFC: Address -Wimplicit-fallthrough warnings. 2024-02-12 12:24:39 -08:00
Cyndy Ishida
f80da87839 [TBDGen] Add back standalone OBJC_METACLASS symbols (#70827)
It turns out there are valid usecases for exposing a standalone
objc-metaclass symbols and tbd files must encode it correctly.

resolves: rdar://118499886
2024-02-12 12:23: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
Andrew Trick
340bd26d23 SwiftCompilerSources: bridge isNoEscape and mayEscape. 2024-02-12 09:57:14 -08:00
Kavon Farvardin
4461030914 NCGenerics: fix AutoDiff tests 2024-02-11 20:40:03 -08:00
nate-chandler
b935996be5 Merge pull request #71491 from nate-chandler/bitwise-copyable/within-module
[BitwiseCopyable] Verify only within module.
2024-02-09 09:49:21 -08:00
Nate Chandler
6f3bb493b4 [BitwiseCopyable] Verify only within module.
Don't verify lowering in modules built from swiftinterface (which may
not have been built with `-enable-experimental-feature BitwiseCopyable`)

Allow trivial types defined in other modules to lack conformance because
those modules may not have been built with the feature enabled.
2024-02-09 07:02:13 -08:00
Andrew Trick
da3f583492 Add mark_dependence [unresolved]
In preparation for inserting mark_dependence instructions for lifetime
dependencies early, immediately after SILGen. That will simplify the
implementation of borrowed arguments.

Marking them unresolved is needed to make OSSA verification
conservative until lifetime dependence diagnostics runs.
2024-02-08 22:53:16 -08:00
Slava Pestov
368721ef5c SIL: Adjust isTypeMetadataForLayoutAccessible() to visit more lowered positions
Fixes part of https://github.com/apple/swift/issues/67645, rdar://119267393
2024-02-07 17:13:33 -08:00
Nate Cook
e317febc9d Revert "Allow normal function results of @yield_once coroutines (#69843)"
This reverts commit aa5b505014.
2024-02-07 14:57:31 -06:00
Anton Korobeynikov
aa5b505014 Allow normal function results of @yield_once coroutines (#69843)
This adds SIL-level support and LLVM codegen for normal results of a coroutine.

The main user of this will be autodiff as VJP of a coroutine must be a coroutine itself (in order to produce the yielded result) and return a pullback closure as a normal result.

For now only direct results are supported, but this seems to be enough for autodiff purposes.
2024-02-06 22:13:15 -08:00
nate-chandler
01bce39100 Merge pull request #71418 from nate-chandler/nfc/20240206/1/rename-inst-class
[NFC] SIL: Renamed SpecifyTestInst.
2024-02-06 22:02:05 -08:00
Nate Chandler
b535725647 [NFC] SIL: Renamed SpecifyTestInst.
The instruction's spelling was changed to `specify_test` but the class
name wasn't updated from `TestSpecificationInst`.  Update it here.
2024-02-06 16:29:09 -08:00
Ellie Shin
e38bc9756c Merge pull request #71083 from apple/es-sil-pkg
Support a package SILLinkage
2024-02-07 09:10:13 +09:00
Slava Pestov
d46bd335de Merge pull request #71371 from slavapestov/ncgenerics-fixes-3
Non-copyable generics fixes, part 3
2024-02-06 08:35:07 -05:00
Hamish Knight
7b012d825c Merge pull request #70600 from hamishknight/postal-service
[ASTWalker] Continue post-walking with `Action::SkipChildren`
2024-02-06 10:24:38 +00:00
Ellie Shin
72a7760027 Support package SIL linkage.
Decls with a package access level are currently set to public SIL
linkages. This limits the ability to have more fine-grained control
and optimize around resilience and serialization.
This PR introduces a separate SIL linkage and FormalLinkage for
package decls, pipes them down to IRGen, and updates linkage checks
at call sites to include package linkage.

Resolves rdar://121409846
2024-02-06 01:23:14 -08:00
Slava Pestov
af50d7e6b8 AST: Add allowInverses flag to AbstractGenericSignatureRequest 2024-02-05 18:43:06 -05:00
Slava Pestov
81027cff23 SIL: Drop conformances to Copyable and Escapable from substitution signature 2024-02-05 18:43:06 -05:00
Hamish Knight
15fa06dd37 [ASTWalker] Cleanup some cases manually doing post-walks
We can replace these with `Action::SkipChildren`.
2024-02-05 15:27:26 +00:00
Hamish Knight
16cfca4186 [ASTWalker] NFC: Rename SkipChildren -> SkipNode
This better describes what the action currently
does, and allows us to re-introduce `SkipChildren`
with the correct behavior.
2024-02-05 15:27:25 +00:00
Erik Eckstein
86f23b089f SIL: add the [perf_constraint] flag in SILFunction
Specifies that the optimizer and IRGen must not add runtime calls which are not in the function originally.
This attribute is set for functions with performance constraints or functions which are called from functions with performance.
2024-02-05 12:26:30 +01:00
Rintaro Ishizaki
b839718351 [AST] Use scoped enum for attribute kinds
Align with other kind enum e.g. DeclKind.
2024-02-02 09:36:48 -08:00
nate-chandler
c0ad612d9a Merge pull request #71335 from nate-chandler/bitwise-copyable/sil-token
[BitwiseCopyable] Permit SILTokenType's nonconformance.
2024-02-02 06:58:39 -08:00
Slava Pestov
066cb8b9a4 SIL: One more SILPrinter fix 2024-02-01 23:35:33 -05:00
Nate Chandler
c148e11741 [TypeLowering] Allow SILToken to !BitwiseCopyable.
Like `ModuleType`, there's no reason to conform this flavor of trivial
type to `BitwiseCopyable`.  So permit it during verification.
2024-02-01 18:08:23 -08:00
Nate Chandler
159571c5ee [NFC] TypeLowering: Tweak verification.
Improved comments, and simplified assertion while making more stringent.
2024-02-01 18:06:45 -08:00
Slava Pestov
80205ecf9c Merge pull request #71241 from slavapestov/ncgenerics-fixes
Non-copyable generics fixes
2024-02-01 07:18:29 -05:00
nate-chandler
902a22d94a Merge pull request #71298 from nate-chandler/bitwise-copyable/remove-unchecked
[BitwiseCopyable] Remove @unchecked behavior.
2024-02-01 03:21:26 -08:00
Slava Pestov
af3ab14986 SILGen: Clean up substitution map construction to deal with Copyable 2024-01-31 21:55:52 -05:00
Slava Pestov
094328ddab SIL: Add some assertions 2024-01-31 21:55:52 -05:00
Nate Chandler
990c318941 Revert "NFC: [TypeLowering] Handle @unchecked BC fields."
This reverts commit 0ae0fdc3b1.
2024-01-31 17:11:55 -08:00
Slava Pestov
45f31b4516 AST: Refactor ASTPrinter to use getRequirementsWithInverses() 2024-01-31 18:40:35 -05:00
Erik Eckstein
b3e5f07a99 SILFunction: don't preserve specialized functions for the debugger 2024-01-31 17:16:12 +01:00
nate-chandler
a43faf89c8 Merge pull request #71242 from nate-chandler/bitwise-copyable/not-for-unchecked
[BitwiseCopyable] Don't derive on @unchecked field
2024-01-31 05:55:38 -08:00
Nate Chandler
0ae0fdc3b1 NFC: [TypeLowering] Handle @unchecked BC fields.
The appearance of a field whose type's conformance to BitwiseCopyable is
@unchecked permits the type not to conform.
2024-01-30 11:21:40 -08:00
Andrew Trick
13db95eac3 BridgedASTType::isEscapable 2024-01-30 08:38:57 -08:00
Andrew Trick
f5e5789984 Merge pull request #71206 from meg-gupta/lifetimedepsil
Lower lifetime dependence info into SIL and infer when absent
2024-01-29 19:56:25 -08:00
Doug Gregor
20b72a19f2 Merge pull request #71219 from DougGregor/abstraction-pattern-typed-throws-bad-assert
[Abstraction pattern] Eliminate unnecessary assertion for typed throws
2024-01-29 16:48:05 -08:00
Meghana Gupta
d598d0440d [NFC] Reorganize lifetime dependence utilities 2024-01-29 15:24:09 -08:00
Doug Gregor
2cef4b97b0 [Abstraction pattern] Eliminate unnecessary assertion for typed throws
Abstraction patterns can handle conversions involving typed throws
nowdays. Remove the assertion, fixing rdar://121617307.
2024-01-29 12:04:19 -08:00
Meghana Gupta
24d6a2953b Lower lifetime dependence info into SIL types 2024-01-29 11:41:41 -08:00