This simplifies the representation and allows clients to handle fewer
cases. It also removes an ambiguity in the representation which could
lead us to have two canonical types for the same type.
This is definitely not working yet, but I'm not making progress on
it quickly enough to unblock what we need to unblock; it'll have to
be fixed in parallel.
* [SILOptimizer] Add prespecialization for arbitray reference types
* Fix benchmark Package.swift
* Move SimpleArray to utils
* Fix multiple indirect result case
* Remove leftover code from previous attempt
* Fix test after rebase
* Move code to compute type replacements to SpecializedFunction
* Fix ownership when OSSA is enabled
* Fixes after rebase
* Changes after rebasing
* Add feature flag for layout pre-specialization
* Fix pre_specialize-macos.swift
* Add compiler flag to benchmark build
* Fix benchmark SwiftPM flags
We had two notions of canonical types, one is the structural property
where it doesn't contain sugared types, the other one where it does
not contain reducible type parameters with respect to a generic
signature.
Rename the second one to a 'reduced type'.
We can't feed resolved DependentMemberTypes into the Requirement Machine
since that will trigger an assertion if there is a missing conformance.
Instead, copy and paste some logic from GenericSignatureBuilder.cpp to
'erase' resolved DependentMemberTypes into unresolved DependentMemberTypes.
std::sort() will sometimes compare an element with itself (?)
so remove the assert here. Duplicate conformance requirements
should be already caught by checkGenericSignature() anyway.
This was manifesting as module interfaces printing generic parameters
as `τ_0_0` in some cases.
Note that the GSB has the same bug, so this test case will fail with
-requirement-machine=off. I don't plan on fixing the bug in the GSB
unless we need to.
Fixes rdar://problem/78977127.
If two associated types in an (invalid) protocol have the same name, use their
source location to order them instead of their memory address. This fixes a
non-deterministic test failure with the requirement machine enabled.
The GSB and RequirementMachine sometimes disagree on whether two
type parameters that have both been equated to the same concrete
type belong to the same equivalence class or not.
Since in practice, this distinction does not matter, relax the
assert here.
Rework Sendable checking to be completely based on "missing"
conformances, so that we can individually diagnose missing Sendable
conformances based on both the module in which the conformance check
happened as well as where the type was declared. The basic rules here
are to only diagnose if either the module where the non-Sendable type
was declared or the module where it was checked was compiled with a
mode that consistently diagnoses `Sendable`, either by virtue of
being Swift 6 or because `-warn-concurrency` was provided on the
command line. And have that diagnostic be an error in Swift 6 or
warning in Swift 5.x.
There is much tuning to be done here.