Is there a way to get the deterministic hash computed by a Type’s storage class? Or another deterministic hash for a given parametric type? I need a hash which doesn’t change from execution to execution.
llvm::hash_value(type) hashes the pointer to a type (which works because types are uniqued) so that doesn’t work for me.
The best I can think of to have a stable hash would be to print the type into a string and hash the string content.
Yeah, that’s the best I could think of as well. In this specific case, operating on a fixed set of types is acceptable so I ended up defining my own on those types. I also discovered that the
llvm::hash-* stuff is also non-stable! It was a fun night…