Files
Ben Cohen 4ef054f59b [SwiftMergeFunctions] Don't rewrite call sites with a mismatched type (#90412)
SwiftMergeFunctions appends the differing constant as a new parameter at
the position defined by the callee, and replaceDirectCallers rebuilds
each direct call by forwarding the call site's own arguments and then
appending the constant. This assumes the call site's function type
matches the callee definition.

That does not hold for a @_silgen_name declaration whose C prototype
omits part of the Swift ABI -- for example the indirect error result of
a function with a large typed throws. The call site then has fewer
parameters than the definition, so the appended constant lands in the
wrong argument slot and the merged callee reads it from a different
register than the caller passes it in, crashing at runtime.

Skip such call sites so a thunk is emitted instead. The thunk forwards
the definition's own arguments and appends the constant in the correct
position.
2026-07-08 13:18:25 +01:00
..
…
…