Prototype for coalescing equivalent specifics of the same generic. (#5314)

This is a working version for coalescing equivalent specifics of the
same generic, with *many* things to add and improve.
This commit is contained in:
Alina Sbirlea
2025-05-29 22:24:13 +00:00
committed by GitHub
parent 370027599c
commit 77afd0678b
18 changed files with 1468 additions and 731 deletions
+2
View File
@@ -25,6 +25,7 @@ auto HandleInst(FunctionContext& context, SemIR::InstId inst_id,
case SemIR::ValueRepr::Copy: {
auto* type = context.GetType(SemIR::GetTypeOfInstInSpecific(
context.sem_ir(), context.specific_id(), inst_id));
context.AddTypeToCurrentFingerprint(type);
context.SetLocal(inst_id, context.builder().CreateLoad(
type, context.GetValue(inst.value_id)));
} break;
@@ -46,6 +47,7 @@ auto HandleInst(FunctionContext& context, SemIR::InstId inst_id,
SemIR::TemporaryStorage /*inst*/) -> void {
auto* type = context.GetType(SemIR::GetTypeOfInstInSpecific(
context.sem_ir(), context.specific_id(), inst_id));
context.AddTypeToCurrentFingerprint(type);
context.SetLocal(inst_id,
context.builder().CreateAlloca(type, nullptr, "temp"));
}