mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-24 11:32:42 +00:00
Replace FoldingSet with DenseMap for instruction canonicalization. (#3979)
Switch from recursing into non-canonical instruction fields to separately canonicalizing those fields. This means we now form canonical `InstBlockId`s, `TypeBlockId`s, `IntId`s, `FloatId`s, and `BindNameId`s at least in the cases when they're referenced by a constant instruction. This reduces the overall runtime for @chandlerc's 10MLoC example by 27.5% on my machine.
This commit is contained in:
1 parent
7b4b7abc6e
commit
5c8fa6ad5c
35 files changed
+479
-505
No files matched your search
@@ -1076,10 +1076,8 @@ auto Context::GetStructType(SemIR::InstBlockId refs_id) -> SemIR::TypeId {
|
||||
|
||||
auto Context::GetTupleType(llvm::ArrayRef<SemIR::TypeId> type_ids)
|
||||
-> SemIR::TypeId {
|
||||
// TODO: Deduplicate the type block here. Currently requesting the same tuple
|
||||
// type more than once will create multiple type blocks, all but one of which
|
||||
// is unused.
|
||||
return GetTypeImpl<SemIR::TupleType>(*this, type_blocks().Add(type_ids));
|
||||
return GetTypeImpl<SemIR::TupleType>(*this,
|
||||
type_blocks().AddCanonical(type_ids));
|
||||
}
|
||||
|
||||
auto Context::GetAssociatedEntityType(SemIR::InterfaceId interface_id,
|
||||
|
||||
Reference in new issue
Block a user