When making a direct call to a thunk, inline the call in SemIR. (#5642)

This preserves the constant values of the arguments to the thunk, which
is important if the thunk requires conversion of an `IntLiteral` to some
other type. This should become unnecessary once we have form support,
but avoiding the indirection through a thunk function seems valuable
even once that support is in place.

To support this, track whether a function is a thunk on the Function
object, and if so, what the callee of the thunk is. This information is
also included in formatted SemIR when dumping the thunk.
This commit is contained in:
Richard Smith authored and GitHub committed 2025-06-11 21:34:01 +00:00
1 parent bdf5f00af0
commit 4e5dccdbf7
22 files changed
+394 -151

No files matched your search

+1 -1
View File
@@ -727,7 +727,7 @@ auto HandleParseNode(Context& context,
auto& function = context.functions().Get(function_id);
if (IsValidBuiltinDeclaration(context, function, builtin_kind)) {
function.builtin_function_kind = builtin_kind;
function.SetBuiltinFunction(builtin_kind);
// Build an empty generic definition if this is a generic builtin.
StartGenericDefinition(context, function.generic_id);
FinishGenericDefinition(context, function.generic_id);