Commit Graph

8065 Commits

Author SHA1 Message Date
Robert Widmann
054d7b9913 Merge pull request #29713 from CodaFi/unused-unwanted-unloved
[Gardening] Silence Some Warning Spew
2020-02-11 15:46:16 -08:00
Arnold Schwaighofer
ea5fa5afd3 IRGen: Cache type metadata construction of Optional types
To achieve this replace the current implementation which recursively
constructs a layout compatible metadata by an implementation that
recursively constructs a layout compatible type and the use
emitTypeMetadataRef on that type to generate the metadata.
2020-02-11 13:32:53 -08:00
Nate Chandler
949029a788 [metadata prespecialization] Create enum records.
Extracted implementation of SpecializedGenericStructMetadataBuilder into
SpecializedGenericNominalMetadataBuilderBase, a CRTP with a template
template argument for the CRTP superclass and a template argument for
the implementation.  That new type is now subclassed by
SpecializedGenericStructMetadataBuilder.  Additionally, this new type is
also subclassed by the newly added SpecializedGenericEnumMetadataBuilder
which is responsible for build the prespecialization of generic enum
metadata.

rdar://problem/56960887
2020-02-11 09:57:22 -08:00
swift-ci
227485bf02 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-10 07:14:14 -08:00
Mishal Shah
f53b1a7ba1 Revert "Emit debug info for generic type aliases. …" 2020-02-09 21:38:45 -08:00
Max Desiatov
67297904ac [WebAssembly] Add ifdefs for the WASI target 2020-02-08 07:37:10 +00:00
swift-ci
8b58328bc6 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-07 17:04:27 -08:00
swift-ci
5f26e93625 Merge pull request #29699 from adrian-prantl/59238327 2020-02-07 16:56:46 -08:00
Robert Widmann
bd1dce89b8 [Gardening] Silence needless double-brace-initialization warnings
See also https://wg21.cmeerw.net/cwg/issue1270
2020-02-07 16:09:31 -08:00
Robert Widmann
3bd0044143 [Gardening] Remove remaining casting artifacts 2020-02-07 16:09:31 -08:00
swift-ci
fda8e977e1 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-07 14:24:32 -08:00
Dan Zheng
a174243159 [AutoDiff upstream] Add SIL differentiability witness IRGen. (#29704)
SIL differentiability witnesses are a new top-level SIL construct mapping
an "original" SIL function and derivative configuration to derivative SIL
functions.

This patch adds `SILDifferentiabilityWitness` IRGen.

`SILDifferentiabilityWitness` has a fixed `{ i8*, i8* }` layout:
JVP and VJP derivative function pointers.

Resolves TF-1146.
2020-02-07 14:10:34 -08:00
Adrian Prantl
e932580c8e Emit debug info for generic type aliases.
Before comparing the potential sugared type for equality is needs to be mapped
into the context to resolve generic type parameters to primary archetypes.

<rdar://problem/59238327>
2020-02-07 14:06:08 -08:00
swift-ci
1a6ffc8b0e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-06 09:24:55 -08:00
nate-chandler
4a97914196 Merge pull request #29488 from nate-chandler/generic-metadata-prespecialization-components/default-on
[metadata prespecialization] On by default.
2020-02-06 09:10:10 -08:00
Nate Chandler
ae1f41e1b2 [metadata prespecialization] Only Apple or linux.
Temporarily disable metadata prespecialization on platforms other than
MacOS, iOS, tvOS, watchOS, or Linux.  At the moment, tests are failing
on Windows with linker errors such as

  demangleToMetadata-558ea9.o : error LNK2001: unresolved external symbol $ss5Int64VN
  demangleToMetadata-558ea9.o : error LNK2001: unresolved external symbol $sSSSHsWP

Once the issue leading to those linker errors has been resolved, the
feature will be enabled on Windows.
2020-02-05 18:06:27 -08:00
Nate Chandler
2f36375a28 [metadata prespecialization] Standardize checks to ref tables.
Previously, some ad hoc checks were done in order to determine whether
the metadata access for a generic type was trivial.  Now, standard
predicates are used, specifically IRGenModule's member functions
isDependentConformance and isResilientConformance.
2020-02-04 11:59:36 -08:00
swift-ci
712d7829d1 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-02-04 09:03:29 -08:00
Owen Voorhees
166555c34f [Diagnostics] Better diagnostic for integer used as a boolean condition 2020-02-03 21:20:41 -08:00
Nate Chandler
e49dd639fd [metadata prespecialization] Enumerate arguments as usual.
Previously, when emitting the metadata accessor, the generic arguments
of the type were enumerated one after the next.  That was fine in most
cases but is incorrect in cases where the actual number of generic
arguments is less than apparent number as when two arguments are required
to be equal.

Now, the arguments are enumerated according to the requirements vended by
the GenericTypeRequirements struct.
2020-01-30 11:30:02 -08:00
swift-ci
70fa9f3288 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-28 16:23:20 -08:00
Med Ismail Bennani
bf41881bcd Move swift runtime failure from linkage name to function name
Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
2020-01-28 22:56:05 +01:00
swift-ci
3d67009b88 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-24 11:03:35 -08:00
Dmitri Gribenko
825127b44f Added an inline keyword to a function defined in a header
Otherwise, we could get an ODR violation due to duplicate definitions
coming from multiple translation units that include this header.
2020-01-24 17:53:00 +01:00
Mike Ash
cd2b54f74e Merge branch 'master' into master-rebranch 2020-01-24 11:30:32 -05:00
David Zarzycki
0fa9a96e00 [IRGen] Fully disable an assert that leaves junk in /tmp
In af0247e92c, this assert was partially
disabled and therefore the assert build compiler abandons large
temporary files that need to wait for /tmp to be cleaned days or weeks
later, if at all.
2020-01-24 07:47:49 -05:00
swift-ci
b068ea573f Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-22 14:24:40 -08:00
Joe Groff
ea1e219e96 Merge pull request #29204 from zoecarver/fix/struct-offset-for-index
Use getMetadataLayout offset instead of manual gep
2020-01-22 14:05:11 -08:00
zoecarver
b3a305b3ab Remove newRet 2020-01-21 17:31:46 -08:00
zoecarver
f99b53d382 Remove debug helpers 2020-01-21 16:05:38 -08:00
zoecarver
bd3d7431c7 Load offset from metadata instead of returning offset directly 2020-01-21 16:04:21 -08:00
swift-ci
7c76036449 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-21 09:03:21 -08:00
Erik Eckstein
cabcecc97e IRGen: in multi-threaded compilation, create all specializations of a function in the same LLVM module.
This increases the chances that multiple specializations from the same function can be merged with LLVM's function merge pass.
2020-01-21 15:33:29 +01:00
zoecarver
7f5f1c3f78 stash 2020-01-19 21:35:51 -08:00
swift-ci
74e66dcd1f Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-19 13:03:49 -08:00
David Zarzycki
f185dd66f1 [QoI] Fix -Wrange-loop-analysis warnings 2020-01-19 13:29:23 -05:00
swift-ci
a5ca8c548f Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-17 19:03:58 -08:00
Slava Pestov
7865015fc5 IRGen: Remove unused variable 2020-01-17 17:25:44 -05:00
zoecarver
7720a628fd Modify to catch issue 2020-01-17 13:16:02 -08:00
Erik Eckstein
1b312a85bd Merge remote-tracking branch 'origin/master' into master-rebranch 2020-01-16 10:39:20 +01:00
Arnold Schwaighofer
4cf5c2e60f Merge pull request #29219 from aschwaighofer/irgen_fix_zero_size_field_instanceStart_2
IRGen: Correctly compute instanceStart for a Swift class that starts …
2020-01-15 13:06:14 -08:00
Varun Gandhi
fe9a4db090 [NFC] Add emitAndAddMethodList to replace several similar methods. (#29207) 2020-01-15 09:48:55 -08:00
Arnold Schwaighofer
7f20d937e9 IRGen: Correctly compute instanceStart for a Swift class that starts with an empty field and is followed by a resilient field
We used to crash for classes that have an empty and a resilient field
during intialization if the object was in the shared cache.

  class CrashInInit {
    var empty = EmptyStruct()
    var resilient = ResilientThing()
  }

What happened was that for such a class we we would compute a
instanceStart of 0. The shared cache builder would then slide the value
of the constant ivar offset for the empty field from 0 to 16. However,
the field offset for empty fields is assumed to be zero and the runtime
does not compute a different value for the empty field and so the field
offset for the empty field remains 0. The runtime then trys to reconcile
the field offset (0) and the ivar offset (16) trying to write to the ivar
offset. However, the ivar offset is marked as constant and so we
crashed.
This can be avoided by correctly computing the instanceStart for such a
class to be 16 such that the shared cache builder does not update the
value of the empty field.

rdar://rdar://58458169
2020-01-15 06:18:41 -08:00
zoecarver
e19f40a25c Use getMetadataLayout offset instead of manual gep 2020-01-14 14:57:40 -08:00
Erik Eckstein
f7d610d2e9 IRGen: don't create ObjC methods with the unnamed_addr attribute
In some places, Foundation is comparing ObjC method pointers.
Therefore LLVM's function merging pass must not create aliases for identica; functions, but instead create thunks.
This can be ensured by not creating ObjC methods with the unnamed_addr attribute.

rdar://problem/58483698
2020-01-14 20:45:00 +01:00
Robert Widmann
5e155d9ef7 Merge pull request #29155 from CodaFi/west-const-story
[Gardening] Sprinkle Const Qualification Around the Frontend
2020-01-14 11:18:53 -08:00
Robert Widmann
2af598fb52 [Gardening] Const-qualify Many Usages of CompilerInstance
For those operations that do not need to emit diagnostics or manipulate modules, there's no reason to mutate the passed instance.
2020-01-14 09:02:10 -08:00
Robert Widmann
bd57f14661 [NFC] Push const IRGenOptions and SILOptions everywhere 2020-01-13 22:01:41 -08:00
Robert Widmann
6407a4d36f [Gardening] Drop an unused parameter 2020-01-13 22:01:41 -08:00
Robert Widmann
eb61931012 [NFC] Grab the private discriminator for a file in IRGenDebugInfo
This was being done at an odd point in the frontend presumably because by that point the private discriminator had been fully computed.  Instead, push the conditions for generating the prefix data down to debug info generation and stop mutating IRGenOptions::DebugFlag in the frontend.
2020-01-13 22:01:41 -08:00