Move default value inst ids to a dedicated value store. (#7810)

Per #7737 we move the default value `InstId` storage from
a block in the `SemIR::Function` data structure to a
`SemIR::File` scoped `ValueStore`.

Moves the default value consistency checking to the general
merge argument pattern matching logic, which changes the
error message issued to the generic one.
This commit is contained in:
Lucile Rose Nihlen
2026-09-21 18:27:01 +00:00
committed by GitHub
parent fa12d9ded2
commit 83ca5b71e3
39 changed files with 281 additions and 295 deletions
+27 -11
View File
@@ -255,17 +255,6 @@ LLVM_DUMP_METHOD auto Dump(const File& file, CppOverloadSetId overload_set_id)
return out.TakeStr();
}
LLVM_DUMP_METHOD auto Dump(const File& file, EntityNameId entity_name_id)
-> std::string {
RawStringOstream out;
out << entity_name_id;
if (entity_name_id.has_value()) {
auto entity_name = file.entity_names().Get(entity_name_id);
out << ": " << entity_name << DumpNameOfEntityName(file, entity_name);
}
return out.TakeStr();
}
LLVM_DUMP_METHOD auto Dump(const File& file,
DeclaredFacetTypeId declared_facet_type_id)
-> std::string {
@@ -314,6 +303,30 @@ LLVM_DUMP_METHOD auto Dump(const File& file,
return out.TakeStr();
}
LLVM_DUMP_METHOD auto Dump(const File& file, DefaultValueId value_id)
-> std::string {
RawStringOstream out;
out << value_id;
if (value_id.has_value()) {
const auto& default_value = file.default_values().Get(value_id);
out << ": " << default_value
<< "\n - raw: " << DumpInstSummary(file, default_value.raw_id)
<< "\n - value: " << DumpInstSummary(file, default_value.value_id);
}
return out.TakeStr();
}
LLVM_DUMP_METHOD auto Dump(const File& file, EntityNameId entity_name_id)
-> std::string {
RawStringOstream out;
out << entity_name_id;
if (entity_name_id.has_value()) {
auto entity_name = file.entity_names().Get(entity_name_id);
out << ": " << entity_name << DumpNameOfEntityName(file, entity_name);
}
return out.TakeStr();
}
LLVM_DUMP_METHOD auto Dump(const File& file, FieldId field_id) -> std::string {
RawStringOstream out;
out << field_id;
@@ -655,6 +668,9 @@ LLVM_DUMP_METHOD static auto MakeConstantId(int id) -> ConstantId {
LLVM_DUMP_METHOD auto MakeSymbolicConstantId(int id) -> ConstantId {
return ConstantId::ForSymbolicConstantId(ConstantId::SymbolicId(id));
}
LLVM_DUMP_METHOD static auto MakeDefaultValueId(int id) -> DefaultValueId {
return DefaultValueId(id);
}
LLVM_DUMP_METHOD static auto MakeEntityNameId(int id) -> EntityNameId {
return EntityNameId(id);
}