Commit Graph

104175 Commits

Author SHA1 Message Date
Rintaro Ishizaki
fbb7bfce60 Merge pull request #30929 from rintaro/sourcekit-setcustombuffer-avoidmemcopy
[SourceKit] Avoid one memcpy on potentially big sourcekit response data
2020-04-10 13:15:15 -07:00
Rintaro Ishizaki
579e662362 Merge pull request #30954 from rintaro/ide-completion-prettystacktrace
[CodeCompletion] Add pretty stacktrace for completion operation
2020-04-10 13:14:54 -07:00
Hamish Knight
a61223a255 [CS] Visit all fixed bindings for constraint re-activation (#30886)
[CS] Visit all fixed bindings for constraint re-activation
2020-04-10 12:27:47 -07:00
Dan Zheng
486e667904 [AutoDiff] Support direct init reference differentiation. (#30946)
Support `@differentiable` function conversion for `init` references, in
addition to `func` references and literal closures. Minor usability improvement.

Resolves SR-12562.
2020-04-10 12:23:19 -07:00
Dan Zheng
a864a57c9a [AutoDiff upstream] Add Differentiable.withDerivative(_:). (#30945)
Add `Differentiable.withDerivative(_:)`, a "derivative surgery" API.

`Differentiable.withDerivative(_:)` is an identity function returning `self`.
It takes a closure and applies it to the derivative of the return value, in
contexts where the return value is differentiated with respect to.
2020-04-10 12:22:56 -07:00
Slava Pestov
cabb657caa Merge pull request #30937 from slavapestov/fix-property-wrapper-vtable-layout-with-subclass
Sema: Force property wrappers in EmittedMembersRequest::evaluate()
2020-04-10 15:15:23 -04:00
Slava Pestov
0724c47a8b IRGen: Fix simple_display(IRGenDescriptor) 2020-04-10 15:05:54 -04:00
Slava Pestov
f12b0d4977 IRGen: Type reconstruction supports opaque result types now 2020-04-10 15:05:54 -04:00
Slava Pestov
43ee8ae282 Serialization: Implement LocalDeclTableInfo::GetExternalKey()
This allows iterating over serialized decl tables, which is useful
for debugging.
2020-04-10 15:05:54 -04:00
Slava Pestov
41ccedc999 AST: Fix opaque type mangling used by type reconstruction
Make sure we mangle opaque types using the same settings as the
debugger mangling (with OptimizeProtocolNames = false) to ensure
that we can reconstruct those names again.
2020-04-10 15:05:54 -04:00
Slava Pestov
2b93b5b5e5 Sema: Force property wrappers in EmittedMembersRequest::evaluate()
Fixes <rdar://problem/61229365>.
2020-04-10 15:05:54 -04:00
Michael Ilseman
38fce16254 [string] Convert IR tests to SIL tests 2020-04-10 11:39:22 -07:00
Michael Ilseman
d02f5bc509 [string] Move wCSIA check higher than _HasContiguousBytes 2020-04-10 11:39:03 -07:00
Rintaro Ishizaki
69971af173 [SourceKit] Avoid one memcpy on potentially big sourcekit response data
A kind indicator is needed before the actual data when custom data are
storeed as xpc dictionary values. Instead of prepending the kind bit by
copying data to another buffer, let the data producers include it in the
created data.
2020-04-10 18:29:12 +00:00
Saleem Abdulrasool
26c61f5183 AutoDiff: repair the cross-module-differentiation on Windows
Make the cross-module differentiation test work on Windows by converting
to a shared library to run the test.
2020-04-10 11:25:40 -07:00
Artem Chikin
efdfceeb9b [Sema] Diagnose use of implementation-only property wrappers
We already ban all structs from declaring storage that comes from implementation-only imports. Until now we missed property wrappers, they were just dropped in deserialization.

Resolves rdar://problem/59403617
2020-04-10 11:19:42 -07:00
Erik Eckstein
e117378d68 tests: add a compile-time test for large string arrays.
rdar://problem/56268570
2020-04-10 20:10:24 +02:00
Erik Eckstein
f83bd2885d tests: fix the timeout.py script and move it to a more central place
A string->float conversion for the command line argument was missing
2020-04-10 20:10:24 +02:00
Erik Eckstein
1de19a1b32 SimplifyCFG: fix a compile time problem with block merging
When merging many blocks to a single block (in the wrong order), instructions are getting moved over and over again.
This is quadratic and can result in very long compile times for large functions.
To fix this, always move the instruction to smaller block to the larger block.

rdar://problem/56268570
2020-04-10 20:10:24 +02:00
Erik Eckstein
242bf15770 Support try_apply and yield in swift::replaceBranchTarget 2020-04-10 20:10:24 +02:00
Erik Eckstein
6da902ef8b Add an option to completely disable SIL verification.
This is useful to disable SIL verification in an assert build of the compiler.
2020-04-10 20:10:24 +02:00
Erik Eckstein
d73686a5b5 SILCombine: limit the worklist size for instruction canonicalization
To be precise: don't add instruction uses to the worklist if it already has more than 10000 elements.
This avoids quadratic behavior for very large functions.

rdar://problem/56268570
2020-04-10 20:10:24 +02:00
Erik Eckstein
4e2cffbbed AliasAnalysis: speed up canApplyDecrementRefCount() for large functions.
This is a workaround for some quadratic complexity in ARCSequenceOpt which calls canApplyDecrementRefCount very frequently.

rdar://problem/56268570
2020-04-10 20:10:24 +02:00
Erik Eckstein
fd6c26e948 EscapeAnalysis: don't compute the connection graph for very large functions
For functions which results in > 10000 nodes, just bail and don't compute the connection graph.
The node merging algorithm is quadratic and can result in significant compile times for very large functions.

rdar://problem/56268570
2020-04-10 20:10:24 +02:00
Erik Eckstein
f33c2ade1d EscapeAnalysis: remove an unused parameter from canOptimizeArrayUninitializedCall
NFC
2020-04-10 20:10:24 +02:00
Saleem Abdulrasool
de9aa59b74 test: repair the AutoDiff test on Windows
`-lm` is not portable, it is only needed on certain platforms (e.g.
Linux, not BSD).  Remove the explicit link.

Avoid using a static library as that is not supported on all platforms
(e.g. Windows).  Use the helper macros to generate the library.

Repairs the Windows tests.
2020-04-10 10:58:22 -07:00
Saleem Abdulrasool
0444df6f50 Merge pull request #30952 from compnerd/autodiff-vs-differential-programming
AutoDiff: repair the test on Windows
2020-04-10 10:56:46 -07:00
Saleem Abdulrasool
d09c0f85bf Merge pull request #30949 from compnerd/fp80-android
AutoDiff: Android, Windows does not support FP80
2020-04-10 10:32:42 -07:00
Hamish Knight
78072de623 [CS] Assert that we don't end up with unsolved constraints
Make sure we don't end up in a situation where we
have unsolved constraints left over and consider
the system fully solved.

This requires tweaking the type matching code for
dependent members such that a concrete base is
considered a failure rather than being left
unsolved. This should only happen when not in
diagnostic mode, as otherwise we use a hole.
2020-04-10 10:16:08 -07:00
Hamish Knight
d69a42d656 [CS] Preserve compatibility for collection coercions
Previously we could allow some invalid coercions to
sneak past Sema. In most cases these would either
cause crashes later down the pipeline or
miscompiles. However, for coercions between
collections, we emitted somewhat reasonable code
that performed a force cast.

This commit aims to preserve compatibility with
those collection coercions that previously
compiled, and emits a warning telling the user to
use either 'as?' or 'as!' instead.
2020-04-10 10:16:07 -07:00
Hamish Knight
6c7d695492 Revert "[Constraint graph] Reinstate the adjacencies of constraint graph nodes."
This reverts commit cf1732cce2.
With `gatherConstraints` no longer visiting
adjacencies, we no longer need to maintain the
adjacency info.
2020-04-10 10:16:07 -07:00
Hamish Knight
47541d86f7 [CS] Visit all fixed bindings for constraint re-activation
Start visiting transitive fixed bindings for type
variables, and stop visiting adjacencies for
`gatherConstraint`'s `AllMentions` mode.

This improves performance and fixes a correctness
issue with the old implementation where we could
fail to re-activate a coercion constraint, and
then let invalid code get past Sema, causing
either miscompiles or crashes later down the
pipeline.

Unfortunately this change requires us to
temporarily drop the non-ephemeral fix for a couple
of fairly obscure cases where the overload hasn't
yet been resolved. The logic was previously relying
on stale adjacency state in order to re-activate
the fix when the overload is bound, but it's not
connected on the constraint graph. We need to find
a way to connect constraints to unresolved
overloads they depend on.

Resolves SR-12369.
2020-04-10 10:16:07 -07:00
Hamish Knight
0df444920e [CS] NFC: Move depthFirstSearch up slightly 2020-04-10 10:16:06 -07:00
Hamish Knight
84a3db45db [CS] Account for type variables when matching metatypes
Previously we could prematurely attempt to perform
a bind of class metatypes without checking for
subtyping. Tweak the logic to not perform a bind
if we can't prove that we're dealing with non-class
types.
2020-04-10 10:16:06 -07:00
Holly Borla
815ecad5c9 [Property Wrappers] Don't continue on to synthesizing and type checking a
property wrapper backing init if the property type doesn't match the
wrapped value type.
2020-04-10 10:07:52 -07:00
Michael Gottesman
c7b671ab33 Merge pull request #30930 from gottesmm/pr-e789a43b68653b4658b5c65d1d836ee36a1074e2
[polymorphic-builtins] Enable test during optimize builds.
2020-04-10 10:06:23 -07:00
Robert Widmann
7c51ed567d Merge pull request #30922 from brettkoonce/rm-benchmark-warning
[benchmark] rm minor warning
2020-04-10 09:57:54 -07:00
Rintaro Ishizaki
de6a402116 [CodeCompletion] Add pretty stacktrace for completion operation 2020-04-10 09:28:40 -07:00
Owen Voorhees
456081715e Merge pull request #30947 from owenv/verifier-asan-fix
[DiagnosticVerifier] Fix ASAN issue in the verifier
2020-04-10 11:25:51 -05:00
Suyash Srijan
6b9dd236a4 [Changelog] Add SE-0268 to the changelog, under Swift 5.3 (#30903) 2020-04-10 17:18:23 +01:00
Robert Widmann
4c4a55f651 Merge pull request #30934 from CodaFi/unchecked-opt-imism
[Gardening] Add Missing Instructions For Setting Optimization Levels in Xcode
2020-04-10 09:16:22 -07:00
Robert Widmann
9269143154 Merge pull request #30735 from owenv/verifier-edu-notes
[DiagnosticVerifier] Support asserting edu notes are emitted
2020-04-10 09:15:55 -07:00
Nathan Lanza
e18bd9903c Convert a clang::Module to non-const to account for a clang API change
An upstream clang changed ASTSourceDescriptor to not have a const
Module pointer. const_cast here to make this agree.

(cherry picked from commit a49bceeedf)
2020-04-10 09:08:33 -07:00
Robert Widmann
f5afb3a01f Merge pull request #30935 from CodaFi/maybe-driver
[driver][Shepherd] Document what a "subcommand" is (NFC)
2020-04-10 08:50:54 -07:00
Saleem Abdulrasool
ccdc8efa95 AutoDiff: repair the test on Windows
The name of the module is encoded into the type name.  The module name
is not `null` on Windows, which would fail to match the name.  It is
possible to make the test less overly-constricted, but setting the
module name to null is simpler and avoids more regex matching.
2020-04-10 08:14:54 -07:00
Saleem Abdulrasool
3528e7e1fa AutoDiff: disable the test cases for FP80
The FP80 tests should not be built on Android or Windows.  This fixes
the Windows run of the test.
2020-04-10 08:11:47 -07:00
Saleem Abdulrasool
4b67e95299 AutoDiff: Android, Windows does not support FP80
Correct the condition for FP80.  This should have no real impact on
Android as the tests are not currently executed.
2020-04-10 08:09:35 -07:00
Saleem Abdulrasool
29085464b2 Merge pull request #30940 from compnerd/magic-numbers-are-good
Platform: alias math constants on Windows
2020-04-10 07:29:46 -07:00
Doug Gregor
6999c318b7 Merge pull request #30924 from DougGregor/for-each-solution-application-target
[Constraint solver] Migrate for-each statement checking into SolutionApplicationTarget
2020-04-10 07:28:21 -07:00
Owen Voorhees
20d3afc439 [DiagnosticVerifier] Fix ASAN issue where Twine was stored to a temporary 2020-04-10 04:53:05 -07:00