Constants were generally cached by type opcode, but all structures share the same type opcode (OpTypeStruct), so they need to be cached by type id.