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
When generating full debug info for generic types, emit the
specification type as an opaque struct with the collection of
substituted generic parameters.
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
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
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
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
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.
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.
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.
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