Get type in specific when lowering certain instructions. (#5493)

Fix handling of instructions where the type lookup has to be based on
the specific.
This commit is contained in:
Alina Sbirlea
2025-05-16 22:25:50 +00:00
committed by GitHub
parent dbf12eb3fc
commit e68d65d4f6
2 changed files with 159 additions and 7 deletions
+9 -7
View File
@@ -22,11 +22,12 @@ auto HandleInst(FunctionContext& context, SemIR::InstId inst_id,
context.SetLocal(inst_id,
llvm::PoisonValue::get(context.GetType(inst.type_id)));
break;
case SemIR::ValueRepr::Copy:
case SemIR::ValueRepr::Copy: {
auto* type = context.GetType(SemIR::GetTypeOfInstInSpecific(
context.sem_ir(), context.specific_id(), inst_id));
context.SetLocal(inst_id, context.builder().CreateLoad(
context.GetType(inst.type_id),
context.GetValue(inst.value_id)));
break;
type, context.GetValue(inst.value_id)));
} break;
case SemIR::ValueRepr::Pointer:
context.SetLocal(inst_id, context.GetValue(inst.value_id));
break;
@@ -42,10 +43,11 @@ auto HandleInst(FunctionContext& context, SemIR::InstId inst_id,
}
auto HandleInst(FunctionContext& context, SemIR::InstId inst_id,
SemIR::TemporaryStorage inst) -> void {
SemIR::TemporaryStorage /*inst*/) -> void {
auto* type = context.GetType(SemIR::GetTypeOfInstInSpecific(
context.sem_ir(), context.specific_id(), inst_id));
context.SetLocal(inst_id,
context.builder().CreateAlloca(context.GetType(inst.type_id),
nullptr, "temp"));
context.builder().CreateAlloca(type, nullptr, "temp"));
}
auto HandleInst(FunctionContext& context, SemIR::InstId inst_id,