No major change in execution time, but why make things more
complicated than they need to be? It does make
SILInstructionResultArray::begin drop out of the top ten functions in
the inverted call stack (not counting performLLVM).
In a non-rigorous test, this change shaves off 20% of the time spent
in SIL optimizations for the standard library in a +Asserts build.
(Admittedly the wins for a no-asserts build will be much lower because
SILInstructionResultArray has a bunch of assertions in its
constructor.)
When introducing SIL cloner support for substitution maps, I failed
to account for the separate handling of substitutions for opened
existentials. Perform this substitution when needed.
Fixes rdar://problem/39976572.
Substitution can be expensive; only do it when there might be something to
substitute. While here, use QueryTypeSubstitutionMapOrIdentity rather than
open-coding the same thing in a lambda.
Replace the tail-allocated Substitution arrays with a SubstitutionMap.
This only affects the internal representation of the instructions, not their
constructors or serialization.
Now that SubstitutionMap is used in so many places, reduce it's header
dependencies by moving SubstitutionMap::Storage into its own separate
implementation header. Use forward declarations of other entities
(GenericSignature, Substitution) instead.
Good for build times and general sanity.
There isn't a clean cut point here, so switch
GenericSpecializationInformation from SubstitutionList to
SubstitutionMap and carry along dual SubstitutionMap/SubstitutionList
representations for a small part of ReabstractionInfo.
Replace two prominent uses of SubstitutionList, in ConcreteDeclRef and
Witness, with SubstitutionMap. Deal with the myriad places where we
now have substitution maps and need substitution lists (or vice versa)
caused by this change.
Overall, removes ~50 explicit uses of SubstitutionList (of ~400).
The class contains two inline operator overloads which are marked as
friends. These overloads actually will be promoted to a global
function. MSVC will not mark them as friends resulting in access to the
members being lost. Explicitly mark the overloads as friends. This is
needed by LLDB.
Rename `Base` to `InstBase`. This is needed to help MSVC disambiguate
the typename from the enumerator member in certain specializations. The
SILInstruction is used in LLDB and when building with MSVC would fail
due to an ambiguous resolution.
The pattern we see for noescape closure passed to objective c is different:
There is the additional without actually escaping closure sentinel.
rdar://39682865
Mandatory pass will clean it up and replace it by a copy_block and
is_escaping/cond_fail/release combination on the %closure in follow-up
patches.
The instruction marks the dependence of a block on a closure that is
used as an 'withoutActuallyEscaping' sentinel.
rdar://39682865