Commit Graph

11193 Commits

Author SHA1 Message Date
Erik Eckstein
44cd8d71d5 SIL: remove some const from decl arguments in SILBasicBlock and SILArgument APIs
It's not needed and would just introduce some const_casts.
2024-10-02 07:10:28 +02:00
swift-ci
e5f97d79c5 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-30 07:15:01 -07:00
nate-chandler
ba8f8ea282 Merge pull request #76526 from nate-chandler/general-coro/20240906/1
[CoroutineAccessors] Initial framing.
2024-09-30 07:04:04 -07:00
Konrad `ktoso` Malawski
45b97f146b Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-30 13:47:39 +09:00
swift-ci
54d8c9feb0 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-29 14:55:02 -07:00
Hamish Knight
bf6bb650ea Merge pull request #76771 from hamishknight/rename-arg-interface-ty
[AST] NFC: Rename `getArgumentInterfaceType` -> `getPayloadInterfaceType`
2024-09-29 22:53:13 +01:00
Hamish Knight
91ae5d6345 [AST] NFC: Rename getArgumentInterfaceType -> getPayloadInterfaceType
IMO this is a slightly clearer name, many of its
uses already use the term "payload".
2024-09-29 17:05:14 +01:00
swift-ci
9b306afc1d Merge remote-tracking branch 'origin/main' into rebranch 2024-09-28 10:15:52 -07:00
Andrew Trick
f787e8f173 Merge pull request #76762 from atrick/predmem_rewrite
[NFC] rewrite PredictableMemOpts dead allocation elimination
2024-09-28 10:11:35 -07:00
Andrew Trick
755a146730 [NFC] rewrite PredictableMemOpts dead allocation elimination
Generalize the code that promotes the remaining uses of an allocation to make it
readable and extensible. We need to be able to promote allocations with more
interesting uses, namely mark_dependence.
2024-09-27 22:24:18 -07:00
Andrew Trick
b5e3b3befc [NFC] PredictableMemOpts: refactor isFullyAvailable.
For use as a general utility.
2024-09-27 22:23:29 -07:00
swift-ci
cde3e4910d Merge remote-tracking branch 'origin/main' into rebranch 2024-09-27 12:34:18 -07:00
Arnold Schwaighofer
29475100bd Merge pull request #76719 from aschwaighofer/revert_pr76656
Revert "Merge pull request #76656 from nate-chandler/rdar136388508"
2024-09-27 12:21:35 -07:00
Nate Chandler
091368ba21 [CoroutineAccessors] Added read.
The name is a placeholder for the mutating single-yield coroutine
accessor.
2024-09-26 18:10:39 -07:00
Nate Chandler
98a2e6a7df [CoroutineAccessors] Added modify.
The name is a placeholder for the mutating single-yield coroutine
accessor.
2024-09-26 18:10:39 -07:00
Ben Barham
c15bc19946 Merge remote-tracking branch 'origin/main' into main-to-rebranch
Conflicts:
  - `lib/Serialization/ModuleFileSharedCore.cpp` new headers on main
2024-09-26 16:01:56 -07:00
Andrew Trick
106e05f549 Merge pull request #76714 from atrick/refactor_predmemopt
[NFC] Refactor PredictableMemoryOptimization
2024-09-26 15:00:05 -07:00
Arnold Schwaighofer
8d8951768c Revert "Merge pull request #76656 from nate-chandler/rdar136388508"
This reverts commit b9228c81d1, reversing
changes made to 6fb2989bcf.

After PR#76686 this bailout should no longer be neccessary.

rdar://136681998
2024-09-26 09:26:21 -07:00
Erik Eckstein
d293fd9157 MoveOnlyWrappedTypeEliminator: handle open_existential_box instructions
Fixes a compiler crash

rdar://136460032
2024-09-26 09:36:54 +02:00
Nate Chandler
ecba5db6e5 [NFC] AST: Added AccessorKind predicates.
And replaced direct comparisons with calls to predicates.  In
preparation for introducing parallel non-underscored accessors.
2024-09-25 21:06:36 -07:00
Andrew Trick
a635e8a292 [NFC] Refactor PredictableMemoryOptimization
In preparation for adding mark_dependence support.
Required to support addressors (unsafeAddress) in places
other than UnsafePointer.pointee.
2024-09-25 18:18:59 -07:00
Erik Eckstein
7ffd270008 embedded: move the VTableSpecializer pass into MandatoryPerformanceOptimizations
MandatoryPerformanceOptimizations already did most of the vtable specialization work.
So it makes sense to remove the VTableSpecializerPass completely and do everything in MandatoryPerformanceOptimizations.
2024-09-25 19:32:14 +02:00
Erik Eckstein
3775a3548e ModulePassContext: add some utility functions
* `specialize(function:)`
* `deserializeCallees(of:)`
* `createWitnessTable()`
* `createSpecializedVTable`
* `Function.set(isSerialized:)`
2024-09-25 19:32:08 +02:00
Erik Eckstein
2950e4521e SIL: representation for specialized witness tables
The main change here is to associate a witness table with a `ProtocolConformance` instead of a `RootProtocolConformance`.
A `ProtocolConformance` is the base class and can be a `RootProtocolConformance` or a `SpecializedProtocolConformance`.
2024-09-25 19:32:08 +02:00
swift-ci
6c7325fc89 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-24 21:20:14 -07:00
nate-chandler
ea23b8a02b Merge pull request #76685 from nate-chandler/rdar136609584
[SILCombine] Destroy unowned with unowned_release.
2024-09-24 21:17:20 -07:00
Nate Chandler
14f9088094 [SILCombine] Destroy unowned with unowned_release.
Don't create strong_release of sil_unowned values when removing
partial_apply instructions.

rdar://136609584
2024-09-24 15:40:38 -07:00
swift-ci
5b6002caeb Merge remote-tracking branch 'origin/main' into rebranch 2024-09-24 01:55:37 -07:00
nate-chandler
b9228c81d1 Merge pull request #76656 from nate-chandler/rdar136388508
[Mem2Reg] Always bail on dynamic_lifetime.
2024-09-23 23:04:18 -07:00
Nate Chandler
c420b0e481 [Mem2Reg] Always bail on dynamic_lifetime.
rdar://136388508
2024-09-23 12:12:11 -07:00
Konrad `ktoso` Malawski
b9319d80f1 Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-23 09:01:06 +09:00
swift-ci
658a00ce26 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-20 14:14:24 -07:00
Kuba (Brecka) Mracek
4a51cfaf27 Merge pull request #76572 from kubamracek/embedded-class-bound-existentials
[embedded] Introduce class-bound existentials into Embedded Swift
2024-09-20 13:58:06 -07:00
Konrad `ktoso` Malawski
d89347bed0 Merge branch 'main' into wip-experimental-isolated-deinit 2024-09-20 18:34:45 +09:00
swift-ci
df338c19a8 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-19 09:34:45 -07:00
Michael Gottesman
92a3e53b02 Merge pull request #76434 from gottesmm/pr-3e00ab647dbc50beececb8c8cf096921bdf7acd3
[concurrency] Represent a SILFunction without isolation as std::optional<ActorIsolation> instead of ActorIsolation::Unspecified.
2024-09-19 09:17:52 -07:00
Kuba Mracek
6b9a3051e3 [embedded] Introduce class-bound existentials into Embedded Swift
Motivated by need for protocol-based dynamic dispatch, which hasn't been possible in Embedded Swift due to a full ban on existentials. This lifts that restriction but only for class-bound existentials: Class-bound existentials are already (even in desktop Swift) much more lightweight than full existentials, as they don't need type metadata, their containers are typically 2 words only (reference + wtable pointer), don't incur copies (only retains+releases).

Included in this PR:
[x] Non-generic class-bound existentials, executable tests for those.
[x] Extension methods on protocols and using those from a class-bound existential.
[x] RuntimeEffects now differentiate between Existential and ExistentialClassBound.
[x] PerformanceDiagnostics don't flag ExistentialClassBound in Embedded Swift.
[x] WTables are generated in IRGen when needed.

Left for follow-up PRs:
[ ] Generic classes support
2024-09-19 07:49:50 -07:00
Michael Gottesman
a0088327d4 [concurrency] Represent a SILFunction without isolation as std::optional<ActorIsolation> instead of ActorIsolation::Unspecified.
The reason why is that we want to distinguish inbetween SILFunction's that are
marked as unspecified by SILGen and those that are parsed from textual SIL that
do not have any specified isolation. This will make it easier to write nice
FileCheck tests against SILGen output on what is the inferred isolation for
various items.

NFCI.
2024-09-18 11:23:22 -07:00
swift-ci
5039a2d86c Merge remote-tracking branch 'origin/main' into rebranch 2024-09-18 10:55:29 -07:00
Doug Gregor
da0c70f301 Merge pull request #76512 from DougGregor/sourcefile-nonopt-buffer
Ensure that SourceFiles always have a backing buffer in the SourceManager
2024-09-18 10:54:52 -07:00
Konrad `ktoso` Malawski
7d1ce789ad Revert "Revert "Isolated synchronous deinit"" 2024-09-17 17:35:38 +09:00
swift-ci
7cd2098fce Merge remote-tracking branch 'origin/main' into rebranch 2024-09-16 23:14:47 -07:00
eeckstein
85ecc954b8 Merge pull request #76448 from eeckstein/fix-static-init-cloner
StaticInitCloner: skip begin_access instructions when cloning the initial value of a global
2024-09-17 07:54:58 +02:00
Doug Gregor
49aa0e966f Ensure that SourceFiles always have a backing buffer in the SourceManager
The "buffer ID" in a SourceFile, which is used to find the source file's
contents in the SourceManager, has always been optional. However, the
effectively every SourceFile actually does have a buffer ID, and the
vast majority of accesses to this information dereference the optional
without checking.

Update the handful of call sites that provided `nullopt` as the buffer
ID to provide a proper buffer instead. These were mostly unit tests
and testing programs, with a few places that passed a never-empty
optional through to the SourceFile constructor.

Then, remove optionality from the representation and accessors. It is
now the case that every SourceFile has a buffer ID, simplying a bunch
of code.
2024-09-16 21:46:42 -07:00
Ben Barham
a7b50f357f Merge remote-tracking branch 'origin/main' into manual-main-merge
Conflicts:
  - `lib/Driver/ToolChains.cpp` conflicting with the `addAllArgs` rename
    for multiple options
2024-09-16 13:53:18 -07:00
Kuba (Brecka) Mracek
a4bd03c542 Merge pull request #76464 from kubamracek/embedded-fix-generics-check-in-perfdiags
[embedded] Fix generic function skipping in PerfDiags, diagnose KeyPathInsts in closures
2024-09-14 18:01:44 -07:00
Erik Eckstein
0ee51e4d90 StaticInitCloner: skip begin_access instructions when cloning the initial value of a global
Fixes a crash when simplifying a load of an UnsafePointer-global which points to another global.

rdar://135223354
2024-09-14 14:12:36 +02:00
Allan Shortlidge
02dbb96b94 AST: Rename AvailabilityContext to AvailabilityRange.
The generality of the `AvailabilityContext` name made it seem like it
encapsulates more than it does. Really it just augments `VersionRange` with
additional set algebra operations that are useful for availability
computations. The `AvailabilityContext` name should be reserved for something
pulls together more than just a single version.
2024-09-13 16:25:18 -07:00
Kuba Mracek
e7b74051e8 [embedded] Fix generic function skipping in PerfDiags, diagnose KeyPathInsts in closures 2024-09-13 15:19:49 -07:00
nate-chandler
d177df981b Merge pull request #76440 from nate-chandler/rdar134198292
[Outliner] Handle multiple consumes of a value.
2024-09-13 07:45:02 -07:00