Commit Graph

12848 Commits

Author SHA1 Message Date
Arnold Schwaighofer
ec890e8b4e Merge pull request #79068 from adrian-prantl/revert
Revert "[Debug info] Emit bound generic class type parameters when em…
2025-01-31 04:21:25 -08:00
Dario Rexin
21c4850f6d Merge pull request #79031 from drexin/wip-143852239
[Runtime] Add specialized CVW entry points for multi payload enums
2025-01-30 21:45:09 -08:00
Anthony Latsis
34f9b80cbc Merge pull request #78750 from AnthonyLatsis/oryza-sativa
[Gardening] Fix some set but not used variables
2025-01-31 04:29:05 +00:00
Adrian Prantl
45d4648bdb Revert "[Debug info] Emit bound generic class type parameters when emitting AST types"
This reverts commit f2132890db
it triggers the debug info sanity check when running the source compatibility testsuite.
2025-01-30 17:27:39 -08:00
Dario Rexin
923cccf1ea [Runtime] Add specialized CVW entry points for multi payload enums
rdar://143852239

Adding these specialized entry points reduces the overhead of the witness functions by removing the first indirection.
2025-01-30 14:44:49 -08:00
Anthony Latsis
a84dfc8387 [Gardening] Fix some set but not used variables 2025-01-30 21:34:38 +00:00
Adrian Prantl
a5dddcee0f Merge pull request #78901 from adrian-prantl/143595521
[Debug info] Retain all type aliases in asttypes mode
2025-01-29 08:27:46 -08:00
Adrian Prantl
d5f6bef046 Merge pull request #78965 from adrian-prantl/remove-fragmenttype
[Debug Info] Remove the mostly unused FragmentStorageType from DebugTypeInfo
2025-01-29 08:27:18 -08:00
Adrian Prantl
f2132890db [Debug info] Emit bound generic class type parameters when emitting AST types
This ensures that debug info for these types is emitted even if this is the only
way they are references in the input program.

rdar://143595521
2025-01-28 17:39:18 -08:00
Saleem Abdulrasool
995bc0e0a6 Merge pull request #78951 from compnerd/through-the-cracks
IRGen: correct some invalid code
2025-01-28 10:47:25 -08:00
Adrian Prantl
e70a3443e9 [Debug Info] Remove the mostly unused FragmentType from DebugTypeInfo
This cleanup allows for more consistent debug info emission since we depend less
on IRGen magic to emit debug info for types.
2025-01-27 17:28:10 -08:00
Tim Kientzle
10f554f5a6 Remove tabs 2025-01-27 15:26:23 -08:00
Tim Kientzle
e5be7657f8 Fix field count in emitted reflection data
PR #78467 omitted certain fields from the FieldDescriptor list,
but did not update the count of fields that's emitted
just before that list.

Update the count so it matches the number of field descriptors
we actually emit.

Resolves rdar://143402921
2025-01-27 14:41:15 -08:00
Adrian Prantl
266fa2af41 [Debug Info] Sink type alias check into DbgTy.isForwardDecl (NFC) 2025-01-27 14:01:54 -08:00
Saleem Abdulrasool
bac1554b43 IRGen: correct some invalid code
`[[fallthrough]]` must be followed by a `case` label. The current use in
IRGen did not follow this requirement. Adjust the logic to match the
requirement. This fixes a few diagnostics that MSVC emitted for this
error.
2025-01-27 11:10:41 -08:00
eeckstein
95f1dfbf07 Merge pull request #78885 from eeckstein/fix-without-actually-escaping
Fix two problems with `withoutActuallyEscaping`
2025-01-27 07:59:02 +01:00
Saleem Abdulrasool
5770d59e4d Merge pull request #78427 from compnerd/internals
IRGen: special case VWT emission linkage computation
2025-01-25 08:51:06 -08:00
Erik Eckstein
3ec5d7de24 SIL: replace the is_escaping_closure instruction with destroy_not_escaped_closure
The problem with `is_escaping_closure` was that it didn't consume its operand and therefore reference count checks were unreliable.
For example, copy-propagation could break it.
As this instruction was always used together with an immediately following `destroy_value` of the closure, it makes sense to combine both into a `destroy_not_escaped_closure`.
It
1. checks the reference count and returns true if it is 1
2. consumes and destroys the operand
2025-01-24 19:23:27 +01:00
John McCall
95dca81d24 Merge pull request #78729 from rjmccall/isolated-sending-results-compiler-fix
Assorted fixes for runtime metadata mangling and demangling
2025-01-23 21:33:50 -05:00
Michael Gottesman
d060f01527 Merge pull request #78837 from gottesmm/rdar-142661388
[rbi] Change Region Based Isolation for closures to not use the AST and instead just use SIL.
2025-01-23 15:48:34 -08:00
John McCall
12bdfbf589 Fix a pair of IRGen bugs around materializing function type metadata
with sending results:

- The sending result mangling was added in the 6.0 runtime, so demangling
  cannot be used to produce this metadata when targeting an earlier
  runtime.

- The combination of a sending result with isolation requires the 6.1
  runtime to successfully demangle, due to a bug in the 6.0 demangler.
2025-01-23 02:24:51 -05:00
Augusto Noronha
683c02cf9d Merge pull request #78728 from augusto2112/fix-resilience-lldb
Fix miscompilations for debugger because of resilience
2025-01-22 22:27:17 -08:00
Augusto Noronha
dca3e147d0 Merge pull request #78691 from augusto2112/rec-deb-info-embed
[DebugInfo] Fix recursively generating debug info for same type
2025-01-22 22:27:08 -08:00
Michael Gottesman
7ae56aab2e [sil] Add a new instruction ignored_use.
This is used for synthetic uses like _ = x that do not act as a true use but
instead only suppress unused variable warnings. This patch just adds the
instruction.

Eventually, we can use it to move the unused variable warning from Sema to SIL
slimmming the type checker down a little bit... but for now I am using it so
that other diagnostic passes can have a SIL instruction (with SIL location) so
that we can emit diagnostics on code like _ = x. Today we just do not emit
anything at all for that case so a diagnostic SIL pass would not see any
instruction that it could emit a diagnostic upon. In the next patch of this
series, I am going to add SILGen support to do that.
2025-01-22 21:12:36 -08:00
Saleem Abdulrasool
0a529c400b Merge pull request #78773 from compnerd/effective-dce
IRGen: remove unused method (NFCI)
2025-01-22 08:26:31 -08:00
Becca Royal-Gordon
ebea19d7b9 Merge pull request #78697 from beccadax/rdar142693093
Work around Foundation NS_TYPED_ENUM bug
2025-01-22 00:57:41 -08:00
Becca Royal-Gordon
0ce403d680 [NFC] Add some pretty stack traces
These would have helped us to debug rdar://142693093 more quickly.
2025-01-21 17:33:09 -08:00
Dario Rexin
59e07f19c9 Merge pull request #78698 from drexin/wip-142918657
[IRGen] Add indirect typed error slot when async function has indirec…
2025-01-21 15:43:46 -08:00
Saleem Abdulrasool
6df1c54c70 IRGen: remove unused method (NFCI)
This function is not used anywhere in the compiler or runtime, so remove
it.
2025-01-21 08:42:11 -08:00
Allan Shortlidge
e50b27f088 Merge pull request #78766 from tshortli/warnings
IRGen/Runtime: Suppress some warnings
2025-01-21 00:19:29 -08:00
Allan Shortlidge
47273273f5 IRGen: Remove unused function isStandardLibrary(). 2025-01-20 20:20:12 -08:00
Saleem Abdulrasool
370cbca889 IRGen: repair a small regression on Windows (#78689)
Correct the IRGen for the standard library. The thinko here assumed that the else case would be evaluated for the standard library build. We ended up incorrectly handling the well-known VWTs from the runtime when building the standard library.
2025-01-20 19:00:05 -08:00
Augusto Noronha
bceb8176dd Fix miscompilations for debugger because of resilience
This patch fixes two instances of the compiler embedded in LLDB
miscompiling code for expression evaluation, because of a combination of
the debugger's access to private types and resilience, which would cause
the generated code to access fields indirectly through resilience functions
that were never emitted.

rdar://137876089
2025-01-17 15:50:09 -08:00
Augusto Noronha
aa6b5c2b63 [DebugInfo] Fix recursively generating debug info for same type
Debug Info generation already has a check to stop it from generating
debug info for a type with the same mangled name. However, most of the
code paths in debug info generation would not add the mangled name to
the cache while generation was not done. This patch fixes that so types
that are in-flight don't have their debug info generated twice.

rdar://142500619
2025-01-17 15:00:03 -08:00
Dario Rexin
30e7ba13b2 [IRGen] Add indirect typed error slot when async function has indirect result
rdar://142918657

Erorrs have to be passed indirectly whenever the result type is indirect.
2025-01-16 15:29:13 -08:00
Saleem Abdulrasool
0e77477147 Merge pull request #78553 from compnerd/well-known-imports
IRGen: further generalise runtime function generation
2025-01-16 09:25:54 -08:00
Arnold Schwaighofer
29bcd2caa0 Merge pull request #78445 from aschwaighofer/loadable_by_address_magic_constant
LoadableByAddress: Replace some magic constants
2025-01-15 15:53:13 -08:00
Saleem Abdulrasool
ec70054c93 IRGen: further generalise runtime function generation
This adjusts the runtime function declaration handling to track the
owning module for the well known functions. This allows us to ensure
that we are able to properly identify if the symbol should be imported
or not when building the shared libraries. This will require a
subsequent tweak to allow for checking for static library linkage to
ensure that we do not mark the symbol as DLLImport when doing static
linking.
2025-01-15 13:54:34 -08:00
Egor Zhdan
18be5e862d Merge pull request #78467 from swiftlang/egorzhdan/sizeof-incomplete
[cxx-interop] Skip type metadata for C++ types that are only used in private C++ fields
2025-01-13 16:58:08 +00:00
Saleem Abdulrasool
0cdcfad408 Merge pull request #78583 from compnerd/fallthrough
IRGen: adjust code for MSVC warning C4468 (NFCI)
2025-01-13 07:47:45 -08:00
Egor Zhdan
738c8fb6c6 [cxx-interop] Skip type metadata for C++ types that are only used in private C++ fields
This fixes compiler errors for C++ types that use pimpl idiom:
```
invalid application of 'sizeof' to an incomplete type
```

rdar://141960396
2025-01-13 12:03:35 +00:00
Alejandro Alonso
09d122af7c Merge pull request #76438 from Azoy/vector
[stdlib] Slab
2025-01-12 10:36:25 -08:00
Saleem Abdulrasool
e37ffad1a6 IRGen: adjust code for MSVC warning C4468 (NFCI)
```
The [[fallthrough]] attribute must be followed by a `case` label or a
`default` label.
```

Restructure the code so that the `[[fallthrough]]` attribute is followed
by the subsequent `case` label for the `switch` statement.
2025-01-11 10:55:21 -08:00
Arnold Schwaighofer
7aef2b549c Fix static variable initializations 2025-01-09 11:42:04 -08:00
finagolfin
f67b35c2f2 Merge pull request #77883 from finagolfin/droid
[android] Use emulated thread-local storage for API 28 and earlier
2025-01-09 15:04:17 +05:30
Alejandro Alonso
515c64fd55 Use current insertion block as other incoming phi for each array element 2025-01-08 10:37:17 -08:00
Alejandro Alonso
08ce821442 If the element type of a B.FA is empty, set its storage type in LLVM to just the padding 2025-01-08 10:37:16 -08:00
Alejandro Alonso
445824dda0 Don't emit builtin metadata in the stdlib if it's generic 2025-01-08 10:37:16 -08:00
Alejandro Alonso
6ffaf4befc Don't ask for TypeInfo of IntegerType when generating debug info for generic args 2025-01-08 10:37:13 -08:00
Allan Shortlidge
d4d9c9e70a TBDGen: Adopt SemanticAvailableAttr. 2025-01-08 08:17:27 -08:00