Commit Graph

11193 Commits

Author SHA1 Message Date
Nate Chandler
e7365aa857 [Outliner] Handle multiple consumes of a value.
If a single native value is bridged multiple times, it cannot be
consumed without other changes.  One option would be to copy it.  The
other option is taken here: sink the destroy of the native value to
after the apply and have the outlined function take the value
guaranteed.

rdar://134198292
2024-09-12 18:42:28 -07:00
Kavon Farvardin
ba0aac3f39 Merge pull request #76093 from kavon/coldsplit-2
ColdBlockInfo: overhaul analysis pass
2024-09-12 16:06:07 -07:00
Kavon Farvardin
2caaad0ba2 ColdBlockInfo: post-order walk converges faster
I thought `reverse(silFn)` would do a post-order walk, but I was wrong.

This patch cuts the number of iterations to propagate coldness from
3-4 down to 2 in a few of the simple regression test cases. At least on
macOS (as the stdlib can vary per platform).
2024-09-11 13:27:39 -07:00
Kavon Farvardin
ec622580fd NFC: explain the searchForExpectedValue 2024-09-11 13:15:45 -07:00
Kavon Farvardin
35e426fc26 NFC: fix comment 2024-09-11 11:54:25 -07:00
Kavon Farvardin
3e93a21a21 ColdBlockInfo: stop early if no coldness
There's no reason to do further stages of analysis to propagate coldness
if there wasn't any found in Stage 1.
2024-09-11 11:54:10 -07:00
swift-ci
cc3d51d633 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-05 21:14:40 -07:00
Ellie Shin
d653a01732 Merge pull request #76278 from swiftlang/elsh/pcmo-diags 2024-09-05 20:56:33 -07:00
swift-ci
da55e84c74 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-05 15:35:33 -07:00
Alejandro Alonso
45d7ea39a5 Merge pull request #75518 from Azoy/integer-generics
Implement Value generics
2024-09-05 15:33:46 -07:00
elsh
66b504a253 [Package CMO] Diagnose missing library-evolution flag.
This PR ensures library-evolution is enabled for Package CMO; without it,
it previously fell back to regular CMO, which caused mismatching serialization
attributes if importing another module that had Package CMO enbaled, causing
an assert fail for loadable types.

Resolves rdar://135308288
2024-09-05 05:55:12 -07:00
swift-ci
5c71a3605f Merge remote-tracking branch 'origin/main' into rebranch 2024-09-04 18:14:28 -07:00
Alejandro Alonso
17eb973fda Update Devirtualize.cpp 2024-09-04 15:13:52 -07:00
Alejandro Alonso
9906db37c7 Fix closures capturing value generics 2024-09-04 15:13:50 -07:00
Alejandro Alonso
b35ac50d3c Optimize TypeValueInst in Swift 2024-09-04 15:13:48 -07:00
Alejandro Alonso
f4f60f4344 Remove Value requirement Add GenericTypeParamKind 2024-09-04 15:13:43 -07:00
Alejandro Alonso
75c2cbf593 Implement value generics
Some requirement machine work

Rename requirement to Value

Rename more things to Value

Fix integer checking for requirement

some docs and parser changes

Minor fixes
2024-09-04 15:13:25 -07:00
swift-ci
b29ebad446 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-04 12:04:17 -07:00
Slava Pestov
b1e0e776b4 AST: Simplify SubstitutionMap::lookupConformance() 2024-09-04 14:57:38 -04:00
Slava Pestov
a3c0e225a7 Merge pull request #76238 from slavapestov/existential-signature-rework-part-3
Allow type variables to appear inside opened existential archetypes
2024-09-04 14:53:18 -04:00
Slava Pestov
be12788a2c SIL: Fix undefined behavior with method call on nullptr
This happened to work with a null genericEnv before, because we didn't
touch `this` when the input type didn't contain any type parameters.
2024-09-04 10:42:18 -04:00
swift-ci
756fe355fa Merge remote-tracking branch 'origin/main' into rebranch 2024-09-03 22:34:34 -07:00
Alex Hoppen
791c1fddc8 Merge pull request #76237 from swiftlang/revert-60057-mpokhylets/isolated-deinit
Revert "Isolated synchronous deinit"
2024-09-03 22:17:09 -07:00
swift-ci
50d4698d95 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-03 20:36:09 -07:00
Slava Pestov
3f317a10fc Merge pull request #76216 from slavapestov/existential-signature-rework-part-2
Convert more callers to use new form of ASTContext::getOpenedExistentialSignature()
2024-09-03 23:22:00 -04:00
Alex Hoppen
c5aa49ba64 Revert "Isolated synchronous deinit" 2024-09-03 18:11:26 -07:00
Kavon Farvardin
7203a4fa73 ColdBlockInfo: overhaul analysis pass
The old analysis pass doesn't take into account profile data, nor does
it consider post-dominance. It primarily dealt with _fastPath/_slowPath.

A block that is dominated by a cold block is itself cold. That's true
whether it's forwards or backwards dominance.

We can also consider a call to any `Never` returning function as a
cold-exit, though the block(s) leading up to that call may be executed
frequently because of concurrency. For now, I'm ignoring the concurrency
case and assuming it's cold. To make use of this "no return" prediction,
use the `-enable-noreturn-prediction` flag, which is currently off by
default.
2024-09-03 15:41:10 -07:00
Slava Pestov
586a36ad75 SIL: Remove call to old form of getOpenedExistentialSignature() 2024-09-03 17:31:27 -04:00
swift-ci
dd7533d4e7 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-03 09:33:55 -07:00
Konrad `ktoso` Malawski
c86e4a8738 Merge pull request #60057 from nickolas-pohilets/mpokhylets/isolated-deinit
Co-authored-by: Konrad `ktoso` Malawski <ktoso@apple.com>
2024-09-04 01:16:56 +09:00
swift-ci
61e4501d18 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-03 04:54:01 -07:00
Egor Zhdan
b3c13e445e Merge pull request #74094 from swiftlang/egorzhdan/scs-inline-dtor
[cxx-interop][SwiftCompilerSources] Remove a workaround
2024-09-03 12:37:35 +01:00
Konrad `ktoso` Malawski
c55ad6fa88 Merge branch 'main' into mpokhylets/isolated-deinit 2024-09-02 23:16:17 +09:00
swift-ci
bc515098a3 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-30 22:14:01 -07:00
nate-chandler
9ee877943e Merge pull request #76186 from nate-chandler/rdar133779160
[ODL] Handle builtins.
2024-08-30 21:54:08 -07:00
Nate Chandler
5d9802f25f [ODL] Handle builtins.
No update is needed for the values they produce.  This pass should
really be refactored not to crash on instructions that aren't explicitly
listed or at least not to compile if not every instruction is listed.

rdar://133779160
2024-08-30 16:09:11 -07:00
swift-ci
b5e42a2e27 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-30 06:33:58 -07:00
eeckstein
7d7ae6bb62 Merge pull request #76155 from rjmansfield/sil-desc-typos
SIL: Fix cl::desc typos. [NFC]
2024-08-30 15:26:59 +02:00
swift-ci
4f23900c42 Merge remote-tracking branch 'origin/main' into rebranch 2024-08-29 17:54:08 -07:00
Slava Pestov
d36dcea88d Merge pull request #76154 from slavapestov/combine-substitution-maps
Move combineSubstitutionMaps() to SILOptimizer and fix an assertion
2024-08-29 20:51:49 -04:00
swift-ci
2e0988b17a Merge remote-tracking branch 'origin/main' into rebranch 2024-08-29 15:14:48 -07:00
Ryan Mansfield
908d97dde5 SIL: Fix cl::desc typos. [NFC] 2024-08-29 16:26:56 -04:00
Slava Pestov
48c456d2bf SILOptimizer: Simplify combineSubstitutionMaps() and fix invariant violation
Fixes rdar://problem/134732867.
2024-08-29 16:18:14 -04:00
Slava Pestov
43c7310288 SILOptimizer: Move combineSubstitutionMaps() to Devirtualize.cpp 2024-08-29 16:18:14 -04:00
Allan Shortlidge
789b795cec SILOptimizer: Allow inlining of transparent functions in @backDeployed thunks.
In order for availability checks in iOS apps to be evaluated correctly when
running on macOS, the application binary must call a copy of
`_stdlib_isOSVersionAtLeast_AEIC()` that was emitted into the app, instead of
calling the `_stdlib_isOSVersionAtLeast()` function provided by the standard
library. This is because the call to the underlying compiler-rt function
`__isPlatformVersionAtLeast()` must be given the correct platform identifier
argument; if the call is not emitted into the client, then the macOS platform
identifier is used and the iOS version number will be mistakenly interpreted as
a macOS version number at runtime.

The `_stdlib_isOSVersionAtLeast()` function in the standard library is marked
`@_transparent` on iOS so that its call to `_stdlib_isOSVersionAtLeast_AEIC()`
is always inlined into the client. This works for the code generated by normal
`if #available` checks, but for the `@backDeployed` function thunks, the calls
to `_stdlib_isOSVersionAtLeast()` were not being inlined and that was causing
calls to `@backDeployed` functions to crash in iOS apps running on macOS since
their availability checks were being misevaluated.

The SIL optimizer has a heuristic which inhibits mandatory inlining in
functions that are classified as thunks, in order to save code size. This
heuristic needs to be relaxed in `@backDeployed` thunks, so that mandatory
inlining of `_stdlib_isOSVersionAtLeast()` can behave as expected. The change
should be safe since the only `@_transparent` function a `@backDeployed` thunk
is ever expected to call is `_stdlib_isOSVersionAtLeast()`.

Resolves rdar://134793410.
2024-08-29 08:43:07 -07:00
Mykola Pokhylets
e0ad7bde82 Merge branch 'main' into mpokhylets/isolated-deinit
# Conflicts:
#	include/swift/Basic/Features.def
#	lib/AST/ASTPrinter.cpp
#	lib/AST/FeatureSet.cpp
2024-08-29 11:28:43 +02:00
swift-ci
93422392cc Merge remote-tracking branch 'origin/main' into rebranch 2024-08-28 18:33:33 -07:00
Slava Pestov
f2fff10cc9 SIL: Synchronous local functions don't need to capture the isolation parameter
Also, move this rule from the computation of lowered captures in SIL,
to the computation of AST captures in Sema. This allows us to
correctly handle the case where an async function nests inside a
sync function. It also removes a special case that was added recently
to cope with a generic `self` type.

Fixes rdar://129366819.
2024-08-28 17:03:49 -04:00
swift-ci
05354cab9a Merge remote-tracking branch 'origin/main' into rebranch 2024-08-27 22:13:30 -07:00
nate-chandler
c56a313d6c Merge pull request #76114 from nate-chandler/rdar133969821_2
[DAH] Bail on pointer use if ignoring barriers.
2024-08-27 21:57:39 -07:00