Commit Graph

24822 Commits

Author SHA1 Message Date
Jonathan Keller
e1ceb4f437 [SILOptimizer] Generalize optimization of static keypaths
We have an optimization in SILCombiner that "inlines" the use of compile-time constant key paths by performing the property access directly instead of calling a runtime function (leading to huge performance gains e.g. for heavy use of @dynamicMemberLookup). However, this optimization previously only supported key paths which solely access stored properties, so computed properties, optional chaining, etc. still had to call a runtime function. This commit generalizes the optimization to support all types of key paths.
2019-12-15 14:10:00 -08:00
Xi Ge
03fab30ee0 Merge branch 'master' into tbdgen-ld-hide 2019-12-14 20:57:05 -08:00
Xi Ge
5e30d0e02b sema: diagnose bad interactions between @available and @_originallyDefinedIn 2019-12-14 18:34:14 -08:00
Xi Ge
3a55c3c96e Front-end: teach the compiler to generate a .c file for $ld$add$os symbols.
When symbols are moved to this module, this module declares them as HIDE
for the OS versions prior to when the move happened. On the other hand, the
original module should declare ADD them for these OS versions. An executable
can choose the right library to link against depending on the deployment target.
This is a walk-around that linker directives cannot specify other install
name per symbol, we should eventually remove this.
2019-12-13 17:22:00 -08:00
swift_jenkins
59fa47cc7a Merge remote-tracking branch 'origin/master' into master-next 2019-12-13 15:20:06 -08:00
Slava Pestov
ff294bdfb1 Merge pull request #28780 from slavapestov/sr-75-cleanups
A handful of cleanups in preparation for building curry thunks in Sema
2019-12-13 18:10:26 -05:00
swift_jenkins
d27b9fd05f Merge remote-tracking branch 'origin/master' into master-next 2019-12-13 14:40:35 -08:00
Slava Pestov
7626f9de4f AST: Small cleanups
- Allow AbstractClosureExpr to be created with null body
- Split up ParameterList::CloneFlags::Inherited
2019-12-13 15:39:47 -05:00
Hamish Knight
36cecb4015 Requestify hasDynamicMemberLookupAttribute for Sema too
Previously we had a request for this in
IDETypeChecking, but this wasn't used for queries
made from Sema. Move the request into Sema, and
move `hasDynamicMemberLookupAttribute` onto
TypeBase.
2019-12-13 11:04:00 -08:00
swift_jenkins
821df072eb Merge remote-tracking branch 'origin/master' into master-next 2019-12-13 08:00:43 -08:00
Saleem Abdulrasool
d3da328b8a Merge pull request #28765 from compnerd/28738
AST: explicitly indicate operator==
2019-12-13 07:49:13 -08:00
swift_jenkins
f048d4cd19 Merge remote-tracking branch 'origin/master' into master-next 2019-12-13 04:40:04 -08:00
Erik Eckstein
4017570de7 Generic Specializer: Use getResilienceExpansion() throughout ReabstractionInfo
It must be consistent, otherwise the specialized function types may not match for calls in functions with different resilience expansions.

Fixes an assertion crash in the generic specializer.

rdar://problem/57844964
2019-12-13 11:15:38 +01:00
swift_jenkins
3b15474d0b Merge remote-tracking branch 'origin/master' into master-next 2019-12-13 00:20:06 -08:00
David Ungar
73a46ce57e Revert "[Incremental, Driver] Only emit a real make-style dependency file for one frontend job." 2019-12-12 22:26:25 -08:00
Xi Ge
66b4737ddc TBDGen: use active platform versions to genearate linker directives 2019-12-12 22:22:28 -08:00
Xi Ge
93a83d3f14 IRGen: reuse linker directives collected from tbd gen to emit these symbols to IR 2019-12-12 22:22:28 -08:00
Saleem Abdulrasool
dedde46df3 AST: explicitly indicate operator==
This is needed to build with VS2019:

```
swift\include\swift\AST\AutoDiff.h(172): error C2593: 'operator ==' is ambiguous
swift\include\swift\Basic\AnyValue.h(129): note: could be 'bool swift::operator ==(const swift::AnyValue &,const swift::AnyValue &)' [found using argument-dependent lookup]
swift\include\swift\AST\AutoDiff.h(172): note: or       'built-in C++ operator==(swift::AutoDiffDerivativeFunctionKind::innerty, swift::AutoDiffDerivativeFunctionKind::innerty)'
swift\include\swift\AST\AutoDiff.h(172): note: while trying to match the argument list '(const swift::AutoDiffDerivativeFunctionKind, const swift::AutoDiffDerivativeFunctionKind)'
```
2019-12-12 21:14:27 -08:00
swift_jenkins
e359fef156 Merge remote-tracking branch 'origin/master' into master-next 2019-12-12 18:19:55 -08:00
Dan Zheng
bb1052ca3e [AutoDiff upstream] Upstream @derivative attribute type-checking. (#28738)
The `@derivative` attribute registers a function as a derivative of another
function-like declaration: a `func`, `init`, `subscript`, or `var` computed
property declaration.

The `@derivative` attribute also has an optional `wrt:` clause specifying the
parameters that are differentiated "with respect to", i.e. the differentiation
parameters. The differentiation parameters must conform to the `Differentiable`
protocol.

If the `wrt:` clause is unspecified, the differentiation parameters are inferred
to be all parameters that conform to `Differentiable`.

`@derivative` attribute type-checking verifies that the type of the derivative
function declaration is consistent with the type of the referenced original
declaration and the differentiation parameters.

The `@derivative` attribute is gated by the
`-enable-experimental-differentiable-programming` flag.

Resolves TF-829.
2019-12-12 18:18:18 -08:00
swift_jenkins
cc083af78f Merge remote-tracking branch 'origin/master' into master-next 2019-12-12 18:00:14 -08:00
swift-ci
d91a675293 Merge pull request #28760 from gottesmm/pr-7d9b6a2372abe97c9eeed1d16b19b29f3c488a1d 2019-12-12 17:46:41 -08:00
Varun Gandhi
a6f5c578e7 Merge pull request #28726 from varungandhi-apple/vg-fix-ClangTypeConverter.getFunctionType
Fix some problems in ClangTypeConverter::getFunctionType
2019-12-12 17:40:55 -08:00
Michael Gottesman
9efb49ac9a [applysite] Add new methods that ease insertion of code after FullApplySites.
Specifically:

1. I renamed the method insertAfter -> insertAfterInvocation and added an
ehaustive switch to ensure that we properly update this code if we add new apply
sites.

2. I added a new method insertAfterFullEvaluation that is like
insertAfterInvocation except that the callback is called with insertion points
after the end/abort apply instead of after the initial invocation of the
begin_apply.
2019-12-12 16:25:10 -08:00
swift_jenkins
7944d36a16 Merge remote-tracking branch 'origin/master' into master-next 2019-12-12 16:19:49 -08:00
swift-ci
aa9281a457 Merge pull request #28757 from dan-zheng/update-index-subset-headers 2019-12-12 16:15:15 -08:00
Varun Gandhi
eabe7bcc76 [AST] Wrap converted clang::FunctionType values in clang::PointerType. 2019-12-12 14:24:46 -08:00
Dan Zheng
63ce61b9aa [AutoDiff] NFC: Use consistent headers for IndexSubset.{h,cpp}.
Left-align headers. Use consistent message. Use accurate year in copyright.
2019-12-12 14:23:28 -08:00
Mike Ash
6c18340675 [Runtime] Remove demangleObjCTypeName and use the old demangler instead.
Archiving expects to be able to instantiate generic classes by name. This previously worked if you had instantiated the specialization in question, because the ObjC runtime would be able to look it up. Now, if the name hasn't been created, Swift has to look it up. demangleObjCTypeName doesn't do generics, so this failed.

rdar://problem/57674583
2019-12-12 15:25:28 -05:00
swift_jenkins
59f4228c23 Merge remote-tracking branch 'origin/master' into master-next 2019-12-12 00:39:59 -08:00
eeckstein
87aac598c8 Merge pull request #28707 from eeckstein/cmo-fixes
Two fixes for cross module optimization
2019-12-12 09:22:13 +01:00
swift_jenkins
fa658f594f Merge remote-tracking branch 'origin/master' into master-next 2019-12-11 21:39:59 -08:00
David Ungar
4c365a7735 Merge pull request #28702 from davidungar/only-one-dependency-file
[Incremental, Driver] Only emit a real make-style dependency file for one frontend job.
2019-12-11 21:21:41 -08:00
swift_jenkins
516cda0b9c Merge remote-tracking branch 'origin/master' into master-next 2019-12-11 19:40:20 -08:00
Michael Gottesman
8e50c97c2b Merge pull request #28725 from gottesmm/pr-1b10b0856adef409da4bed3d4af33137abf625cf
[ownership] Change BorrowScopeIntroducerValue::areInstructionsWithinScope to take SILInstructions instead of BranchPropagatedUser.
2019-12-11 19:21:55 -08:00
swift_jenkins
1fba729d62 Merge remote-tracking branch 'origin/master' into master-next 2019-12-11 18:40:34 -08:00
Michael Gottesman
0d08f8c802 Merge pull request #28724 from gottesmm/pr-4e2a94eb74331d3c9eadc35c9c0df4c978adc200
[sil] Move partial apply combiner code from SILCombiner into InstOptUtils.h/SILCombinerApplyVisitor.cpp.
2019-12-11 18:28:40 -08:00
Michael Gottesman
d815c603c2 [ownership] Change BorrowScopeIntroducerValue::areInstructionsWithinScope to take SILInstructions instead of BranchPropagatedUser.
All non cond_br SILInstructions are layout compatible with BranchPropagatedUser
since BPU just stores a PointerIntPair that leaves its low bits as zero unless
one adds a cond_br. Since in these cases, the SILInstructions are all not
cond_br, we can use this alternative API.

I also added some asserts to validate that the assumption that all such
SILInstructions are not cond_br is respected.
2019-12-11 16:55:13 -08:00
David Ungar
2fc0f7899c Fix comment for OnlyOneDependencyFile 2019-12-11 15:49:12 -08:00
Michael Gottesman
113c22a680 [sil] Move partial apply combiner code from SILCombiner into InstOptUtils.h/SILCombinerApplyVisitor.cpp.
This is in preparation for moving this into the mandatory combiner.
2019-12-11 14:48:19 -08:00
swift_jenkins
6b53fd184c Merge remote-tracking branch 'origin/master' into master-next 2019-12-11 11:00:08 -08:00
Brent Royal-Gordon
7543a89cc4 Merge pull request #27683 from brentdax/i-understood-that-reference
[NFC] Distinguish references to names from declarations of those names by type
2019-12-11 10:50:57 -08:00
swift_jenkins
702a96fd9b Merge remote-tracking branch 'origin/master' into master-next 2019-12-11 09:41:08 -08:00
Ravi Kandhadai
af3aa03e0d Merge pull request #28697 from ravikandhadai/oslog-generic-operator-bug-fix
[Constant Evaluator] Fix a bug in the composition of substitution maps
2019-12-11 09:29:31 -08:00
Erik Eckstein
f03956b30c Cross-module-optimization: Serialize immediately after CrossModuleSerializationSetup
Otherwise it can happen that e.g. specialization runs between CrossModuleSerializationSetup  and serialization, resulting that an inlinable function references a shared function (which doesn't have a public linkage).
The solution is to move serialization right after CrossModuleSerializationSetup. But only do that if cross-module-optimization is enabled (it would be a disruptive change to move serialization in general).
2019-12-11 18:14:41 +01:00
Brent Royal-Gordon
db15d82ffa [NFC] Miscellaneous improvements to Playground and PCMacro transforms 2019-12-11 00:55:18 -08:00
Brent Royal-Gordon
6a8598a99c [NFC] Remove DeclNameRef staging calls 2019-12-11 00:55:18 -08:00
Brent Royal-Gordon
addbe3e5ed [NFC] Thread DeclNameRef through most of the compiler
This huge commit contains as many of the mechanical changes as possible.
2019-12-11 00:55:18 -08:00
Brent Royal-Gordon
da88512eda [NFC] Take DeclNameRef in UnqualifiedLookup and lookupQualified() 2019-12-11 00:55:17 -08:00
Brent Royal-Gordon
9a57554bdf [NFC] DeclNameRef-ify qualified and unqualified lookup 2019-12-11 00:55:17 -08:00