[PATCH] D122974: prevent ConstString from calling djbHash() more than once

Luboš Luňák via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 23:06:47 PDT 2022


llunak added a comment.

In D122974#3532822 <https://reviews.llvm.org/D122974#3532822>, @dblaikie wrote:

> If we want a structure that can use a stable hash

Not for D124704 <https://reviews.llvm.org/D124704>. It doesn't make sense to require a stable hash algorithm for an internal cache file. All that it requires is that StringMap provides the hash value for a string, which it does with the public hash(). If that implementation changes, the EXPENSIVE_CHECKS assert will find that when unittesting the LLDB parts, and in that case the versioned cache file can have its version increased and problem solved. Even in case StringMap implementation changes in a way that no longer makes it feasible to store the precomputed hash value it's simpler to just dump the optimization.

So no need to overcomplicate this. As for the case of somebody else trying to rely on the stability of the hash, I can solve that by adding a comment that says it's not stable (and then that somebody else can go to the lengths of making it stable if needed).


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122974/new/

https://reviews.llvm.org/D122974



More information about the llvm-commits mailing list