Commit Graph

275 Commits

Author SHA1 Message Date
Anthony Latsis
17fc00f8a7 [test] IRGen: Adjust FileCheck patterns for new nuw attribute in upstream LLVM
This attribute was introduced in
7eca38ce76d5d1915f4ab7e665964062c0b37697 (llvm-project).

Match it using a wildcard regex, since it is not relevant to these
tests.

This is intended to reduce future conflicts with rebranch.
2025-05-04 03:28:56 +01:00
Arnold Schwaighofer
7b510cc5dd Add test case 2025-04-09 07:17:31 -07:00
Konrad `ktoso` Malawski
fda7f539fb Reapply "Task names" (#79562) (#79600) 2025-03-08 10:58:49 +09:00
Konrad `ktoso` Malawski
09003d6f11 Revert "Merge pull request #77609 from ktoso/wip-task-names" (#79562)
This reverts commit 4ab5d2604f.
2025-02-23 22:59:21 -08:00
Konrad `ktoso` Malawski
4ab5d2604f Merge pull request #77609 from ktoso/wip-task-names
[Concurrency] Task names
2025-02-21 22:28:33 +09:00
swift-ci
6ea9995a81 Merge remote-tracking branch 'origin/main' into rebranch 2024-10-19 18:57:20 -07:00
Allan Shortlidge
cb578172ea Tests: Remove -disable-availability-checking in more tests that use concurrency.
Use the `%target-swift-5.1-abi-triple` substitution to compile the tests for
deployment to the minimum OS versions required for use of _Concurrency APIs,
instead of disabling availability checking.
2024-10-19 12:35:20 -07:00
Arnold Schwaighofer
0acfda8f6c [rebranch] Fix test/IRGen/async/protocol_resilience.swift 2024-09-09 09:41:36 -07:00
Arnold Schwaighofer
d04c736c75 [rebranch] Fix test/IRGen/async/class_resilience.swift on Windows
Less/no constant folding is happening.
2024-09-09 09:41:16 -07:00
Felipe de Azevedo Piovezan
2880517113 [DebugInfo] Don't emit debug info for async suspend/dispatch functions
Those functions are effectively outlined functions with an alwaysinline
attribute. By removing their debug info and relying on the inliner to propagate
the call site location to the inlined instructions, we restore the "original"
locations as if the function had never been outlined.

This is technically relying on an implementation detail of the inliner, but it
seems to be the simplest way of addressing this issue.
2024-08-14 09:25:44 -07:00
Michael Gottesman
d28eef2d62 [sending] Convert the TaskGroup APIs 2024-06-21 06:11:17 -07:00
Konrad `ktoso` Malawski
2ec717b115 [Concurrency] TaskExecutor ownership fixes (#74000) 2024-06-14 22:56:33 +09:00
John McCall
d8767b7724 Pass the task option record pointer to swift_task_create as a pointer.
We add the `memory(argmem: readwrite)` attribute to swift_task_create,
which means that the call is only allowed to read or write "pointer
operands".  LLVM is smart enough to look through obvious ptrtoint
casts, but not to look through integer selects and so on, which is what
we produce when there's an opaque optional operand that feeds into the
builtin.  This was causing miscompiles under optimization when using
`@isolated(any)` function types for task creation, since we're not yet
clever enough to fold the function_extract_isolation for a known function
(and of course it's not necessarily a known function anyway).
2024-03-15 00:40:54 -04:00
John McCall
3f883f9b89 Fix test for 32-bit targets. Fixes rdar://124537251 2024-03-13 14:04:55 -04: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
John McCall
14dcab6bcd Restore (TaskOptionRecordKind)0 to set the initial serial executor.
This has been the behavior of the runtime since the initial release.
Initially, it was thought that task executors would provide similar
functionality, so they naturally took over the enumerator.  After that
changed, we forgot to change it back.  Fortunately, we haven't released
any versions of Swift with the task executors feature yet, so it's not
too late to fix this.
2024-03-08 00:15:10 -05: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
Doug Gregor
dc85ae3fc6 Choose between AsyncIteratorProtocol's next() and nextElement() based on availability
This allows us to not break backward deployment
2024-01-25 16:04:47 -08:00
Doug Gregor
239f8d8a78 Rename AsyncIteratorProtocol._nextElement -> nextElement 2024-01-25 16:04:43 -08:00
Doug Gregor
bb7a563e6c Switch async for-each loop over to _nextElement and drop @rethrows.
This couples together several changes to move entirely from
`@rethrows` over to typed throws:

* Use the `Failure` type to determine whether an async for-each loop
will throw, rather than depending on rethrows checking

* Introduce a special carve-out for `rethrows` functions that have a
generic requirement on an `AsyncSequence` or `AsyncIteratorProtocol`,
which uses that requirement's `Failure` type as potentially being part
of the thrown error type. This allows existing generic functions like
the following to continue to work:

    func f<S: AsyncSequence>(_: S) rethrows

* Switch SIL generation for the async for-each loop from the prior
`next()` over to the typed-throws version `_nextElement`.

* Remove `@rethrows` from `AsyncSequence` and `AsyncIteratorProtocol`
entirely. We are now fully dependent on typed throws.
2024-01-25 16:04:43 -08:00
Yuta Saito
7cccbcc84f [DiscardingTG] Remove reabstraction thunk for () -> Void to () -> T (#70537)
Concurrency runtime expects discarding task operation entrypoint
function not to have result type, but the current SILGen
implementation generates reabstraction thunk to convert `() -> Void`
to `() -> T` for the operation function.

Since the `T` is always `Void` for DiscardingTG, the mismatch of result
type expectation does not cause any problem on most platforms, but the
signature mismatch causes a problem on WebAssembly.

This patch introduces new builtin operations for creating discarding
task, which always takes `() -> Void` as the operation function type.
2024-01-10 07:17:15 +09:00
Yuta Saito
be0d577fb8 Merge pull request #69349 from kateinoigakukun/pr-3de18d9014fc3da9b742ebb9cbfb9f893eda75a1
[wasm][test] Skip some executable IRGen tests
2023-10-24 07:05:47 -07:00
Yuta Saito
4e4a1fbe59 [wasm][test] Disable a test that depends on swifttailcc 2023-10-24 00:32:31 +00:00
Yuta Saito
8b4ce2c2ff [wasm][test] Remove unused argc/argv parameters from @main decl
In WebAssembly, `main` function is mangled differently depending on if
it takes argc/argv or not. If it doesn't take them, it's mangled to
`main` as well as other platforms, so remove unused argc/argv in
executable tests to avoid linkage failure.
2023-10-24 00:15:58 +00:00
swift-ci
ed5001c1df Merge remote-tracking branch 'origin/main' into rebranch 2023-10-12 07:14:31 -07:00
Yuta Saito
8879ff9c7c Merge pull request #69040 from kateinoigakukun/pr-6d42e536650ae7a8ff01731f7afd6cf8d9feedb7
[wasm][test] Add objc_codegen feature to exclude enable-objc-interop tests
2023-10-12 07:10:44 -07:00
Yuta Saito
5f684ec75f [wasm][test] Add objc_codegen feature to exclude enable-objc-interop tests
Clang does not accept `-x objective-c` with WebAssembly target and it
crashes with "Objective-C support is unimplemented for object file
format" for now. `-enable-objc-interop` can work without the objc
runtime support (which is indicated by `objc_interop` feature), so this
adds a new `objc_codegen` feature to require Objective-C support only
at compile-time.
2023-10-11 00:51:17 +00:00
Augusto Noronha
efc86aafb5 Merge pull request #68843 from augusto2112/keep-funcs-for-deb-tests
Keep certain function that are potentially used in the debugger
2023-10-09 13:58:21 -07:00
Yuta Saito
edaf81a025 [test][IRGen] Repair async/non_musttail_target.sil
`-disable-llvm-optzns -disable-swift-specific-llvm-optzns
-disable-objc-interop` was wrong way to avoid llvm coroutine lowering.
2023-10-08 06:59:11 +00:00
Nate Chandler
84c505f459 [Test] Reenabled test.
rdar://72893124
2023-10-06 11:28:45 -07:00
Augusto Noronha
1c4b67afd1 Adapt tests to changes to keep functions for debugger on Onone
Now that we keep many more functions on unoptimized builds, many tests
need to be changed to either:
- Account for function that wasn't being emitted before to being emitted
  now.
- Account for functions that previously were being emitted lazily to
  being emitted eagerly now.
2023-10-06 11:08:10 -07:00
Alex Lorenz
6ecea1ac09 Merge pull request #68481 from hyp/eng/no-nocapture
[IRGen][interop] do not add 'nocapture' to not bitwise takable types
2023-09-26 07:52:05 -07:00
Alex Lorenz
4858cb6225 [IRGen][interop] do not add 'nocapture' to not bitwise takable types
The use of 'nocapture' for parameters and return values is incorrect for C++ types, as they can actually capture a pointer into its own value (e.g. std::string in libstdc++)

rdar://115062687
2023-09-25 17:43:34 -07:00
Erik Eckstein
b5de7e4e49 IRGen: fix -disable-llvm-optzns
If LLVM optimizations are to be disabled, we cannot just not run all LLVM passes, because there are some mandatory LLVM passes, like coro splitting.
Instead, just run the -O0 LLVM pipeline if -disable-llvm-optzns is used.

Fixes compiler crashes if -disable-llvm-optzns is used.

Note: if one wants to see the output of IRGen, -emit-irgen can be used.
2023-09-25 09:20:04 +02:00
Andrew Trick
0dd90a7ffc Update old closure tests for current conventions
Fixes assert:
SIL verification failed: on-stack closures do not support owned arguments:
2023-08-10 11:17:53 -07:00
Arnold Schwaighofer
c012196e0f Fix some tests for armv7k 2023-06-23 08:41:17 -07:00
Arnold Schwaighofer
59f270840b Fix some IRGen tests on arm64e 2023-06-23 08:17:51 -07:00
Andrew Trick
da52e752c0 Update IRGen test for opaque pointers 2023-06-23 06:57:38 -07:00
Arnold Schwaighofer
52961c9b57 Try to fix windows/linux 2023-06-21 13:12:15 -07:00
Arnold Schwaighofer
3b5ebaa46c Fix some tests in IRGen folder 2023-06-21 10:10:32 -07:00
Arnold Schwaighofer
c1a93e0bde Move tests over to use the %use_no_opaque_pointers option 2023-06-14 10:49:48 -07:00
Erik Eckstein
82734b6ac2 Swift Optimizer: simplification for apply, try_apply, begin_apply and partial_apply
* move the apply of partial_apply transformation from simplify-apply to simplify-partial_apply
* delete dead partial_apply instructions
* devirtualize apply, try_apply and begin_apply
2023-05-11 08:11:44 +02:00
Saleem Abdulrasool
4f24543b5c Merge pull request #63660 from compnerd/async-tests
test: adjust tests for mandatory tail calls on Win64
2023-03-30 14:19:06 -07:00
Kavon Farvardin
363448a0d7 bring back the noncopyable Job type in the _Concurrency lib
This reverts commit abe377ce68.

Co-authored-by: Konrad `ktoso` Malawski <konrad_malawski@apple.com>
2023-03-24 08:58:40 -07:00
Konrad `ktoso` Malawski
abe377ce68 [Workaround][Concurrency] Mark Job as NOT moveonly until we fix moveonly types (#64536) 2023-03-23 07:43:51 +09:00
Konrad `ktoso` Malawski
24a38fc090 [Concurrency] Verify the #if guards around moveonly Job (#64477) 2023-03-20 20:09:45 +09:00
Saleem Abdulrasool
4f6a054705 test: adjust tests for mandatory tail calls on Win64
Since we are force enabling the mandatory tail calls on Windows x64,
even at the expense of stack traces and debugging support, adjust the
tests to account for the difference.
2023-03-06 10:39:03 -08:00
Nate Chandler
ed623d7b64 [NFC] Shortened SIL [init] flag.
Instead of writing out [initalization] for some instructions, use [init]
everywhere.
2022-10-27 10:38:54 -07:00
Anthony Latsis
c1908f688e Gardening: Migrate test suite to GH issues: IRGen 2022-09-01 06:35:57 +03:00
Holly Borla
8713d78704 [PrintOptions] Print explicit 'any' in SIL. 2022-08-18 01:15:12 -04:00