Commit Graph

1696 Commits

Author SHA1 Message Date
swift-ci
b7921a8232 Merge remote-tracking branch 'origin/main' into rebranch 2024-07-06 14:34:09 -07:00
Slava Pestov
fae01d9776 AST: Remove ModuleDecl parameter from more places 2024-07-06 12:05:46 -04:00
swift-ci
9a10a6c56a Merge remote-tracking branch 'origin/main' into rebranch 2024-06-28 23:34:18 -07:00
Dario Rexin
22fec31574 [IRGen] Properly convert between ptr and int in typed error mapping
rdar://130781414
2024-06-28 16:29:10 -07:00
swift-ci
f2e68e5db1 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-28 11:36:11 -07:00
Ben Barham
d72f5b12c4 Update StringRef::equals references to operator==
`equals` has been deprecated upstream, use `operator==` instead.
2024-06-27 19:14:06 -07:00
swift-ci
4213be1cb9 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-22 02:55:53 -07:00
Dario Rexin
35b2b71475 Merge pull request #74192 from drexin/wip-typed-throws-abi
[IRGen] Return typed errors directly in synchronous functions when po…
2024-06-22 02:35:10 -07:00
Xi Ge
736ccef626 Merge remote-tracking branch 'apple/main' into rebranch 2024-06-20 15:16:55 -07:00
Tim Kientzle
1098054291 Merge branch 'main' into tbkka-assertions2 2024-06-18 17:52:00 -07:00
Dario Rexin
d9bc2cb2fa [IRGen] Return typed errors directly in synchronous functions when possible
rdar://129359355

This PR implements the basic support for returning typed errors directly and applies it to synchronous functions.
2024-06-14 17:20:01 -07:00
swift-ci
b861f5c6f3 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-14 07:15:26 -07:00
Konrad `ktoso` Malawski
2ec717b115 [Concurrency] TaskExecutor ownership fixes (#74000) 2024-06-14 22:56:33 +09:00
Arnold Schwaighofer
19557cd6a2 Merge pull request #74304 from aschwaighofer/use_static_alloca_for_stackAlloc
IRGen: Use static alloca for builtin stackAlloc when possible
2024-06-14 06:54:41 -07:00
swift-ci
3328274e09 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-11 21:34:22 -07:00
Nate Chandler
2d70de8a7f [IRGen] Assert on retaining noncopyable. 2024-06-11 14:46:03 -07:00
Arnold Schwaighofer
89b6f91a9f IRGen: Use static alloca for builtin stackAlloc when possible
rdar://129599643
2024-06-11 12:14:09 -07:00
swift-ci
a523f4942e Merge remote-tracking branch 'origin/main' into rebranch 2024-06-05 20:14:34 -07:00
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
Nate Chandler
2a5d07522d [SIL] Add extend_lifetime instruction.
It indicates that the value's lifetime continues to at least this point.
The boundary formed by all consuming uses together with these
instructions will encompass all uses of the value.
2024-06-05 16:28:26 -07:00
swift-ci
74c6fdf3e7 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-23 21:34:24 -07:00
Akira Hatanaka
b5cc5615bd [SILGen] Fix a crash when a closure is converted to a block returning a value indirectly (#73520) 2024-05-23 21:22:32 -07:00
swift-ci
a9bcb33a0a Merge remote-tracking branch 'origin/main' into rebranch 2024-05-23 07:15:46 -07:00
Arnold Schwaighofer
d89bf2893b IRGen: Properly adjust the closure type of a partial_apply of an objc_method
It needs to match with the (large loadable) lowered closure type in the rest of
the program: Large types in the signature need to be passed indirectly.

rdar://127367321
2024-05-22 09:39:15 -07:00
swift-ci
27875fab06 Merge remote-tracking branch 'origin/main' into rebranch 2024-05-13 10:35:09 -07:00
Emil Pedersen
0be63d0422 [DebugInfo] Return complete variable info from getVarInfo by default
getVarInfo() now always returns a variable with a location and scope.
To opt out of this change, getVarInfo(false) returns an incomplete variable.
This can be used to work around bugs, but should only really be used for
printing.

The complete var info will also contain the type, except for debug_values,
as its type depends on another instruction, which may be inconsistent if
called mid-pass.

All locations in debug variables are now also stripped of flags, to avoid
issues when comparing or hashing debug variables.
2024-05-10 16:12:56 -07:00
swift-ci
a51df69c93 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-29 10:34:28 -07:00
Emil Pedersen
ce68d74025 Merge pull request #73276 from Snowy1803/doc-and-fixes
[DebugInfo] Improve documentation & Fix discovered bugs
2024-04-29 10:22:46 -07:00
Emil Pedersen
c2c16f53dd [DebugInfo] Fix undef debug values being removed 2024-04-26 16:31:16 -07:00
swift-ci
3c8a651a0d Merge remote-tracking branch 'origin/main' into rebranch 2024-04-26 04:54:47 -07:00
Arnold Schwaighofer
6794012ea1 IRGen: Fix the load to indirect argument peephole
When the source of the load is a projection we have to bail because the
code later can't handle it.
2024-04-25 15:41:51 -07:00
Ben Barham
445ee1ec14 Manually merge rebranch into main
Conflicts:
  - `lib/ClangImporter/ImportDecl.cpp` as `isPure` is now
    `isPureVirtual`
2024-04-25 13:48:57 -07:00
nate-chandler
c1ecef79dc Merge pull request #73191 from nate-chandler/rdar125265980
[IRGen] Deadends don't need dealloc_pack_metadata.
2024-04-24 16:17:08 -07:00
Nate Chandler
da38fb51fb [IRGen] Deadends don't need dealloc_pack_metadata.
There is a debug-build-only verification that is done for
alloc_pack_metadata instructions that checks that there exist paired
dealloc_pack_metadata instructions which will be keyed off of to clean
up the on-stack variadic metadata packs corresponding to (the
instruction after) the alloc_pack_metadata.

StackNesting omits the deallocation instruction (as does
PackMetadataMarkerInserter) if it would be created in a dead end block.
If all blocks in the dominance frontier of the alloc_pack_metadata
instruction are dead-end blocks, then the verification will incorrectly
fail.  It should not fail because it is not necessary to clean up the
on-stack pack metadata (or any other stack allocations) in such a case.

If all such blocks are dead-end blocks, however, the
alloc_pack_metadata's block itself is a dead-end block as well.  So
during the verification, check whether the alloc_pack_metadata occurs in
a dead-end block and do not fail verification if it does.

rdar://125265980
2024-04-24 07:24:20 -07:00
swift-ci
c955a2a812 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-13 11:56:13 -07:00
Arnold Schwaighofer
93f0615555 IRGen: Freeze undef switch, select, cond_br arguments
Let's make `cond_br undef : $Builtin.Int1, then, else` (and the like) a defined
LLVM IR operation with un-specfied behavior.

rdar://126231554
2024-04-12 16:24:43 -07:00
swift-ci
5b6eadf416 Merge remote-tracking branch 'origin/main' into rebranch 2024-04-12 13:37:42 -07:00
Erik Eckstein
ac4bc89c9a SIL: add the borrowed-from instruction.
It declares from which enclosing values a guaranteed phi argument is borrowed from.
2024-04-10 13:38:10 +02:00
Erik Eckstein
1b1d5ed020 IRGen: support the @sensitive attribute
Call `swift_clearSensitive` after destroying or taking "sensitive" struct types.

Also, support calling C-functions with "sensitive" parameters or return values. In SIL, sensitive types are address-only and so are sensitive parameters/return values.
Though, (small) sensitive C-structs are passed directly to/from C-functions. We need re-abstract such parameter and return values for C-functions.
2024-04-09 12:01:11 +02:00
Ben Barham
17b34312df [IRGen] Start cleaning up typed pointers
Typed pointers are slowly being removed. There's a lot more cleanup to
do here, since really all `IRGenModule::.*PtrTy` should just be `PtrTy`,
but this at least gets us compiling for now.
2024-04-08 08:58:59 -07:00
Arnold Schwaighofer
917ae2d051 LargeTypesReg2Mem: Forward the address of large formally by-val arguments and return values of C functions
rdar://47978338
2024-04-02 13:11:16 -07:00
Anton Korobeynikov
d84847ac9d Reland Allow normal function results of @yield_once coroutines (#71645)
* Allow normal function results of @yield_once coroutines

* Address review comments

* Workaround LLVM coroutine codegen problem: it assumes that unwind path never returns.
This is not true to Swift coroutines as unwind path should end with error result.
2024-03-27 13:09:02 -07:00
Ellie Shin
56d337d322 Merge pull request #72249 from apple/es/pkg-cmo 2024-03-13 09:26:35 -07:00
John McCall
27e0edfacc Merge pull request #72244 from rjmccall/builtin-initial-serial-executor
Add builtin support for starting a task on a specific executor
2024-03-12 18:54:29 -04:00
Ellie Shin
a3250e426d Support Package CMO
* Add a new flag -experimental-package-cmo that requires -experimental-allow-non-resilient-access.
* Support serializing package decls for CMO in package if enabled.
* Only applies to default mode CMO.
* Unlike the existing CMO, package CMO can be built with -enable-library-evolution as package
modules are required to be built together in the same project.
* Create hasPublicOrPackageVisibility to opt in for package decls; needed for CMO, SILVerifier,
and other call sites that verify or determine codegen.

Resolves rdar://121976014
2024-03-12 15:00:24 -07:00
John McCall
0901b2b0b3 Add builtin support for starting a task on a specific executor.
This should be close enough to the creation of this builtin that we don't
need a new feature for it specifically.
2024-03-11 19:44:50 -04:00
Emil Pedersen
8df1abe111 Merge pull request #72158 from Snowy1803/simplify-dbg-type-size
[DebugInfo] Move type size information to CompletedDebugTypeInfo
2024-03-11 10:31:45 -07:00
Nate Chandler
5ccec0e31c [NFC] SIL: Shortened member name.
Renamed "getUsesMoveableValueDebugInfo" to "usesMoveableValueDebugInfo".
Clarifies the predicate from "does the receiver have the
usesMoveableValueDebugInfo field set?" to "does the receiver use moveable
value debug info?".
2024-03-08 21:24:38 -08:00
Emil Pedersen
4ede40e2f7 [DebugInfo] Remove passing of the unused SizeIsFragmentSize (NFC) 2024-03-07 15:21:44 -08:00
John McCall
0a282c044f Unify all of the task-creation builtins coming out of SILGen.
We've been building up this exponential explosion of task-creation
builtins because it's not currently possible to overload builtins.
As long as all of the operands are scalar, though, it's pretty easy
to peephole optional injections in IRGen, which means we can at
least just use a single builtin in SIL and then break it apart in
IRGen to decide which options to set.

I also eliminated the metadata argument, which can easily be recreated
from the substitutions.  I also added proper verification for the builtin,
which required (1) getting `@Sendable` right more consistently and (2)
updating a bunch of tests checking for things that are not actually
valid, like passing a function that returns an Int directly.
2024-03-06 22:21:12 -05:00