This is a follow up to changes related to contextual availability
(https://github.com/apple/swift/pull/29921) which increased score
for unavailable declarations only if they were overloaded but
overlooked a case of a single unavailable choice.
Resolve: rdar://problem/60047439
Since constraint system now handles pattern matching it has
to preverse label matching semantics which existed in original
code: if pattern element has a label it has to match the one
in the tuple type it's matched against.
Resolves: rdar://problem/60048356
Specifically if we have a begin_access [read] or a begin_access [modify] that is
never actually written to. In that case if we can prove that the load [copy] is
completely within the exclusive access region, we will load_borrow. Example:
```
%0 = begin_access [read] ...
%1 = load [copy] %0
...
destroy_value %1
end_access %0
```
=>
```
%0 = begin_access [read] ...
%1 = load_borrow %0
...
end_borrow %1
end_access %0
```
rdar://60064692
Found the meaning by looking at when Definite Initialization marks alloc_stack
with that marker.
For those who are unware like me, it means the liveness of the value in the
alloc_stack is conditional in some way (i.e. conditional init, destroy, etc).
Specifically, we do not handle cases where we use projections,
open_existential_addr, or load_borrow. We should be able to handle those in the
future.
The best part is that ossa makes this really easy to do correctly.
rdar://60064817
The "opened type" of a subscript reference has all references to Self
immediately substituted out, which destroys the link between Self and
the opened existential type we form for the "fully opened type". This
means, in general, we cannot use this type when rewriting subscript
applies, or we'll miss closing opened existentials.
Use the "fully opened type" everywhere except the AnyObject subscript
path. Then, add an assertion that AnyObject subscripts never involve
opened archetypes that we would have to close.
Resolves SR-11748, rdar://57092093
This is just better information to have since one wants to not only know the
instruction, but also the specific value used on the instruction since behavior
can vary depending upon that. The operand is what ties the two together so it is
a natural fit.
Now that this is done, I am going to work on refactoring out converting a
LiveRange from @owned -> @guaranteed. It will be a consuming operation using a
move operator since once the transformation has completed, the LiveRange no
longer exists.
I need this refactored functionality since I am going to need it when
eliminating phi-webs.