On Fri, Nov 22, 2019 at 02:43:25PM -0500, Jason Merrill wrote: > > @@ -5358,6 +5410,18 @@ struct tree_cache_traits > > : simple_cache_map_traits<default_hash_traits<tree>, tree> { }; > > We should probably use tree_hash instead of default_hash_traits here. OK > with or without that change.
Dunno, I'd say pointer_hash <Type>::hash which is return (hashval_t) ((intptr_t)candidate >> 3); might be actually better hash function than #define TREE_HASH(NODE) ((size_t) (NODE) & 0777777) at least on 64-bit hosts, because union tree_node is 8-byte aligned there, so the low 3 bits are all zero and we use all of the 32 bits above that. For 32-bit hosts, it might be better to just use candidate without shifting I guess, there aren't any extra bits we get in from above. TREE_HASH to me unnecessarily uses the low 3 bits known to be zero and masks with 0x3ffff, so throws away also 14 bits that could hold useful info, leaving for 64-bit hosts only 15 bits. Jakub