We deallocate an instruction's packs at points where no further
control flow path uses the value. In the case of an alloc_stack,
this will be right after the dealloc_stack. Thus, if alloc_stack
allocates some packs to build type metadata for a tuple type
that contains a pack, and then proceeds to allocate a value
large enough to hold the tuple, we will free the second allocation
first, before we free the pack, as expected.
However, after stack allocating the value, alloc_stack does
some further work to emit debug info. This could result in
emission of additional metadata packs.
Split up the debug info emission into two parts; the first we do
before we perform the stack allocation, the rest we do after.
- Fixes https://github.com/swiftlang/swift/issues/67702.
- Fixes rdar://problem/141363236.
It derives the address of the first element of a vector, i.e. a `Builtin.FixedArray`, from the address of the vector itself.
Addresses of other vector elements can then be derived with `index_addr`.
This change emits debug info for witness tables passed into generic
functions when a generic type is constrained to a protocol. This
information is required for LLDB's generic expression evaluator
to work in such functions.
rdar://104446865
Certain dynamic casts cannot work safely with isolated conformances,
regardless of what executor the code runs on. For such cases, reject
all attempts to conform to the type.
The mapTypeIntoContext() call in visitFullApplySite() was not
necessary.
The type in question is already fully substituted and should
no longer contain type parameters.
However, it can contain archetypes, which is what caused
mapTypeIntoContext() to assert.
Indeed, this case where the return type is generic but still
loadable wasn't covered by our test suite.
- Fixes https://github.com/swiftlang/swift/issues/80020.
- Fixes rdar://147051717.
`-Xfrontend -enable-cond-fail-message-annotation`
LLVM IR produced by the Swift compiler will add the `annotation`
metadata attribute to the branch instruction generated for cond_fail
builtins.
This patch adds support for serialization of debug value instructions. Enablement is currently gated behind the -experimental-serialize-debug-info flag.
Previously, debug_value instructions were lost during serialization. This made it harder to debug cross module inlined functions.
We can't always use an outlined function, destroy_addr's implementation
already handles cases where this is true (such as opened archetypes).
rdar://143456806
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
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.
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
```
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.
I am adding this instruction to express artificially that two non-Sendable
values should be part of the same region. It is meant to be used in cases where
due to unsafe code using Sendable, we stop propagating a non-Sendable dependency
that needs to be made in the same region of a use of said Sendable value. I
included an example in ./docs/SIL.rst of where this comes up with @out results
of continuations.
Large tuples of values (e.g char[32]) can be passed directly at the abi
boundry but expand to a big explosion of values.
Peephole this explosion at argument passing and return value passing
points to avoid code size growth associated with the explosion.