Commit Graph

12816 Commits

Author SHA1 Message Date
Augusto Noronha
53d1844396 [DebugInfo] Emit witness and objc method declarations in debug info
When emitting a method definition in debug info, the compiler should
also emit the method's declaration, because LLVM LTO can't unify type
definitions when a child DIE is a full subprogram definition. This is
already the behavior for standard methods, this patch implements the
same behavior for witness and objc methods as well.

rdar://123334375
2024-02-29 10:13:10 -08:00
Konrad `ktoso` Malawski
c56a1e8be7 [Distributed] Handle mangling thunks in extensions with generic AS and $Stubs (#71914) 2024-02-29 04:22:00 -08:00
John McCall
69c8f53e76 [NFC] Remove "Runtime" from this feature name to avoid confusion 2024-02-29 03:00:43 -05:00
Adrian Prantl
23e6e54ca1 Merge pull request #71925 from Snowy1803/recursive-sroa
[DebugInfo] Add debug info support for recursive SIL SROA
2024-02-28 20:05:57 -08:00
Emil Pedersen
0faa055c11 [DebugInfo] Add debug info support for recursive SIL SROA
This removes the restriction that only one fragment is allowed at
the end of a SIL DIExpression.

rdar://100046900
2024-02-28 12:48:17 -08:00
Arnold Schwaighofer
0affb27b17 Merge pull request #71936 from aschwaighofer/resilient_wt_relative_wt_fatal_error
IRGen: Convert an assert to a fatalError
2024-02-28 09:14:48 -08:00
Adrian Prantl
52c1f5067b Merge pull request #71934 from adrian-prantl/123117522
Emit original-source-range comment in inline macro expansion files.
2024-02-28 08:37:55 -08:00
Augusto Noronha
10d263b388 [DebugInfo] Fix bound generic types debug info generation
When generating full debug info for generic types, emit the
specification type as an opaque struct with the collection of
substituted generic parameters.
2024-02-27 17:49:27 -08:00
Arnold Schwaighofer
2767d2afe2 IRGen: Convert an assert to a fatalError
Using resilient witness tables with relative protocol witness tables is not supported.
2024-02-27 16:15:02 -08:00
Adrian Prantl
1e50be370d Emit original-source-range comment in inline macro expansion files.
rdar://123117522
2024-02-27 15:30:24 -08:00
Michael Gottesman
11f0ff6e32 [sil] Ensure that all SILValues have a parent function by making it so that SILUndef is uniqued at the function instead of module level.
For years, optimizer engineers have been hitting a common bug caused by passes
assuming all SILValues have a parent function only to be surprised by SILUndef.
Generally we see SILUndef not that often so we see this come up later in
testing. This patch eliminates that problem by making SILUndef uniqued at the
function level instead of the module level. This ensures that it makes sense for
SILUndef to have a parent function, eliminating this possibility since we can
define an API to get its parent function.

rdar://123484595
2024-02-27 13:14:47 -08:00
Felipe de Azevedo Piovezan
76252f8846 Merge pull request #71888 from felipepiovezan/felipe/dynamic_self_loc
[DebugInfo] Fix dynamic self debug loc
2024-02-26 21:57:08 -08:00
Felipe de Azevedo Piovezan
07d58959a2 [DebugInfo] Fix dynamic self debug loc
The instructions related to producing DynamicSelf metadata are always placed at
the start of the function. This creates an issue: which debug location should be
used in order to preserve a sane line table? The current implementation just
uses w/e debug location is present in the new insertion point, which could, for
example, be a debug_declare whose location is not suitable for these purposes.

This patch addresses the issue by removing the debug location of instructions
associated with producing DynamicSelfMetadata.

rdar://120408665
2024-02-26 15:15:37 -08:00
Ben Barham
1306f2b32a Merge pull request #71863 from bnbarham/remove-makearrayref
Use the new template deduction guides rather than `makeArrayRef`
2024-02-25 21:06:51 -08:00
Ben Barham
f292ec9784 Use the new template deduction guides rather than makeArrayRef
LLVM has removed `make*ArrayRef`, migrate all references to their
constructor equivalent.
2024-02-23 20:04:51 -08:00
Ben Barham
1de479d4c1 Remove the last few llvm::Optional
Not sure how I missed these in the previous lot, but actually remove all
this time.
2024-02-23 16:42:30 -08:00
Pavel Yaskevich
f9ec3b1d7e Merge pull request #71796 from xedin/make-dist-new-requirements-conditionally-available
[Distributed] Make new protocol requirements conditionally available
2024-02-22 15:18:52 -08:00
Akira Hatanaka
b3f302b96b [IRGen] Fix a bug where an argument wasn't annotated with sret (#71459)
Fix a bug in expandExternalSignatureTypes where it wasn't annotating a function call parameter type with sret when the result was being returned indirectly.

The bug was causing calls to ObjC methods that return their results indirectly to crash.

Additionally, fix the return type for C++ constructors computed in expandExternalSignatureTypes. Previously, the return type was always void even on targets that require constructors to return this (e.g., Apple arm64), which was causing C++ constructor thunks to be emitted needlessly.

Resolves rdar://121618707
2024-02-22 14:14:47 -08:00
eeckstein
f9b3302cd5 Merge pull request #71810 from eeckstein/remove-inst-leak-checking
SIL: remove instruction leaks checking
2024-02-22 21:13:14 +01:00
Mishal Shah
cb96ec2893 Merge remote-tracking branch 'origin/main' into bump-swift-version-to-6 2024-02-22 09:44:44 -08:00
eeckstein
d1961e1126 Merge pull request #71808 from eeckstein/global_async_function_pointers
Support statically initialized global async function pointers
2024-02-22 16:44:38 +01:00
Akira Hatanaka
97a814805a [IRGen] Make sure a C++ constructor thunk is called when it's needed (#71790)
This fixes a bug where the thunk for a C++ constructor call wasn't being
called when the constructor was called the second time.
2024-02-22 07:05:07 -08:00
nate-chandler
4154cdb475 Merge pull request #71799 from nate-chandler/noncopyable-bugs/20240221/2
[IRGen] Outlined value functions that destroy move-only-with-deinit types take and forward those types' metadata.
2024-02-22 06:53:05 -08:00
Konrad `ktoso` Malawski
1d44e2e8e0 [Distributed] Undo new record and mangling scheme for dist.p.witnesses (#71801) 2024-02-22 23:02:29 +09:00
Erik Eckstein
3488cd364f SIL: remove instruction leaks checking
It's not thread safe and can cause false alarms in case multiple modules exist in different threads. E.g. when building swiftmodules from interfaces.
The leaking check is not important anymore because the builder APIs enforce that instructions are not leaking.
I.e. it's not possible to create an instruction without inserting it into a basic block. Also, it's not possible to remove an instruction from a block without deleting it.

rdar://122169263
2024-02-22 14:09:11 +01:00
Erik Eckstein
9aff04a65a Support statically initialized global async function pointers
rdar://123327436
2024-02-22 09:38:18 +01:00
Nate Chandler
36b473d365 [IRGen] Pass deinit metadata to outlined release.
Given a releasable value which contains a noncopyable value type with a
deinit, that values outlined release function, among other things, must
call the deinit of that noncopyable value type.  In order to do that,
its type metadata must be passed to the value function if it has an
archetype.
2024-02-21 19:31:52 -08:00
Nate Chandler
f3b9dec880 [IRGen] Collect nc deinit metadata for outlining.
Some outlined functions call deinits for noncopyable values.  These
deinits require the metadata for the full type.

Teach the OutliningMetadataCollector to collect the metadata for these
types, when the new needsDeinit flag is set.

Also add the new needsLayout flag.  For now, all outlined functions need
it.
2024-02-21 19:31:52 -08:00
Arnold Schwaighofer
e6ca3a670e Merge pull request #71791 from aschwaighofer/large_types_reg2mem_sigh
LargeTypesReg2Mem: Gracefully handle the case when the Container type is deemed small but the Containee is not
2024-02-21 19:12:43 -08:00
Nate Chandler
4cd073a841 [Gardening] IRGen: Marked a function private. 2024-02-21 17:53:34 -08:00
Nate Chandler
1056067e73 [Gardening] IRGen: Tweaked some variable names.
Made a function reasonably debuggable (type -> ty) and renamed
misleading variable (formalType -> astType).
2024-02-21 17:53:34 -08:00
Nate Chandler
f0f9351421 [NFC] IRGen: Extracted callOutlinedRelease.
In preparation to sometimes use a metadata collector.
2024-02-21 17:53:34 -08:00
Nate Chandler
93595e4e86 [NFC] IRGen: Extracted method. 2024-02-21 17:53:34 -08:00
nate-chandler
cccaf012aa Merge pull request #71770 from nate-chandler/rdar123203791
[NFC] IRGen: Extracted TI::withMetadataCollector.
2024-02-21 17:52:54 -08:00
nate-chandler
94b06b4111 Merge pull request #71787 from nate-chandler/noncopyable-bugs/20240221/1
[IRGen] Lower release_value_addr of noncopyable to deinit call.
2024-02-21 17:52:34 -08:00
Pavel Yaskevich
6789506474 [IRGen] Distributed: Skip protocols that don't require witness tables for decodeNextArgument call 2024-02-21 13:29:47 -08:00
Pavel Yaskevich
738ac14489 [IRGen] Distributed: Dispatch decodeNextArgument via witness thunk if concrete decoder is not available
Since distributed actors can now be generic over actor system
it's no longer guaranteed for concrete decoder to be present,
we need to handle that case specifically during accessor emission.
2024-02-21 13:29:47 -08:00
Pavel Yaskevich
c0dc88878c Revert "[IRGen] Distributed: Always invoke decodeNextArgument through witness thunk"
This reverts commit 4d4c80b8ec.
2024-02-21 13:29:47 -08:00
Arnold Schwaighofer
a17d79cd72 LargeTypesReg2Mem: Fix copy_addr optimization
Make sure that the value we store is the loaded value ...
rdar://123340151
2024-02-21 13:26:07 -08:00
Mishal Shah
b8cd763b21 Merge branch 'main' into bump-swift-version-to-6 2024-02-21 12:40:54 -08:00
Arnold Schwaighofer
7f1fc90df7 LargeTypesReg2Mem: Gracefully handle the case when the Container type is deemed small but the Containee is not
rdar://123340151
2024-02-21 12:38:57 -08:00
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Nate Chandler
274e7c90fe [IRGen] Lower RVA(mo) to direct deinit call.
When lowering a release_value_addr instruction whose operand is a
value type with a deinit, directly emit a call to the deinit.
2024-02-21 10:56:56 -08:00
Nate Chandler
48e1428f11 [NFC] IRGen: Extracted TI::withMetadataCollector.
Deduplicate some code.
2024-02-21 07:03:41 -08:00
Augusto Noronha
de75f0aa7e Merge pull request #71769 from augusto2112/gen-class-enum
Generate full debug info for generic enums and classes, and emit spare bits mask of MPE enums
2024-02-21 06:34:19 -08:00
Arnold Schwaighofer
aab7c8957e Merge pull request #71767 from aschwaighofer/large_types_reg2mem_c_signature
LargeTypesReg2Mem: Remove overzealous assert
2024-02-21 04:00:34 -08:00
Mishal Shah
b488702cc9 Merge remote-tracking branch 'origin/main' into bump-swift-version-to-6 2024-02-20 21:04:47 -08:00
Augusto Noronha
393849290b [DebugInfo] Emit full DWARF info for generic classes and enums 2024-02-20 20:03:14 -08:00
Arnold Schwaighofer
216b3c8c9d LargeTypesReg2Mem: Remove overzealous assert
Functions with c convention can have large direct arguments that are not
re-written by the LoadableByAddress pass before they get to reg2Mem
optimization.

https://github.com/apple/swift/issues/71757
2024-02-20 16:44:30 -08:00
Augusto Noronha
af1d477674 [DebugInfo] Emit a MultiPayloadEnum's spare bits mask in DWARF 2024-02-20 15:38:46 -08:00