[llvm] r341113 - Hashing: use 64-bit seed for hashing on all platforms.

Galina Kistanova via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 31 11:48:04 PDT 2018


Hello Tim,

This commit added broken tests on one of our builders:
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/19508
. . .
Failing Tests (2):
    LLVM-Unit :: ADT/./ADTTests.exe/HashingTest.HashCombineRangeGoldenTest
    Clang :: CodeGenCXX/catch-undef-behavior.cpp

Please have a look?
The builder was already red and did not send notifications on this.

Thanks

Galina

On Thu, Aug 30, 2018 at 1:29 PM Tim Northover via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: tnorthover
> Date: Thu Aug 30 13:28:32 2018
> New Revision: 341113
>
> URL: http://llvm.org/viewvc/llvm-project?rev=341113&view=rev
> Log:
> Hashing: use 64-bit seed for hashing on all platforms.
>
> get_execution_seed returns a size_t which varies across platforms, but its
> users actually always feed it into a uint64_t role so it makes sense to be
> consistent.
>
> Mostly this is just a tidy-up, but it also apparently allows PCH files to
> be
> shared between Clang compilers built for 32-bit and 64-bit hosts.
>
> Modified:
>     llvm/trunk/include/llvm/ADT/Hashing.h
>     llvm/trunk/lib/Support/Hashing.cpp
>
> Modified: llvm/trunk/include/llvm/ADT/Hashing.h
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Hashing.h?rev=341113&r1=341112&r2=341113&view=diff
>
> ==============================================================================
> --- llvm/trunk/include/llvm/ADT/Hashing.h (original)
> +++ llvm/trunk/include/llvm/ADT/Hashing.h Thu Aug 30 13:28:32 2018
> @@ -133,7 +133,7 @@ hash_code hash_value(const std::basic_st
>  /// undone. This makes it thread-hostile and very hard to use outside of
>  /// immediately on start of a simple program designed for reproducible
>  /// behavior.
> -void set_fixed_execution_hash_seed(size_t fixed_value);
> +void set_fixed_execution_hash_seed(uint64_t fixed_value);
>
>
>  // All of the implementation details of actually computing the various
> hash
> @@ -316,9 +316,9 @@ struct hash_state {
>  /// This variable can be set using the \see llvm::set_fixed_execution_seed
>  /// function. See that function for details. Do not, under any
> circumstances,
>  /// set or read this variable.
> -extern size_t fixed_seed_override;
> +extern uint64_t fixed_seed_override;
>
> -inline size_t get_execution_seed() {
> +inline uint64_t get_execution_seed() {
>    // FIXME: This needs to be a per-execution seed. This is just a
> placeholder
>    // implementation. Switching to a per-execution seed is likely to flush
> out
>    // instability bugs and so will happen as its own commit.
> @@ -326,8 +326,7 @@ inline size_t get_execution_seed() {
>    // However, if there is a fixed seed override set the first time this is
>    // called, return that instead of the per-execution seed.
>    const uint64_t seed_prime = 0xff51afd7ed558ccdULL;
> -  static size_t seed = fixed_seed_override ? fixed_seed_override
> -                                           : (size_t)seed_prime;
> +  static uint64_t seed = fixed_seed_override ? fixed_seed_override :
> seed_prime;
>    return seed;
>  }
>
> @@ -402,7 +401,7 @@ bool store_and_advance(char *&buffer_ptr
>  /// combining them, this (as an optimization) directly combines the
> integers.
>  template <typename InputIteratorT>
>  hash_code hash_combine_range_impl(InputIteratorT first, InputIteratorT
> last) {
> -  const size_t seed = get_execution_seed();
> +  const uint64_t seed = get_execution_seed();
>    char buffer[64], *buffer_ptr = buffer;
>    char *const buffer_end = std::end(buffer);
>    while (first != last && store_and_advance(buffer_ptr, buffer_end,
> @@ -446,7 +445,7 @@ hash_code hash_combine_range_impl(InputI
>  template <typename ValueT>
>  typename std::enable_if<is_hashable_data<ValueT>::value, hash_code>::type
>  hash_combine_range_impl(ValueT *first, ValueT *last) {
> -  const size_t seed = get_execution_seed();
> +  const uint64_t seed = get_execution_seed();
>    const char *s_begin = reinterpret_cast<const char *>(first);
>    const char *s_end = reinterpret_cast<const char *>(last);
>    const size_t length = std::distance(s_begin, s_end);
> @@ -496,7 +495,7 @@ namespace detail {
>  struct hash_combine_recursive_helper {
>    char buffer[64];
>    hash_state state;
> -  const size_t seed;
> +  const uint64_t seed;
>
>  public:
>    /// Construct a recursive hash combining helper.
>
> Modified: llvm/trunk/lib/Support/Hashing.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Hashing.cpp?rev=341113&r1=341112&r2=341113&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/Support/Hashing.cpp (original)
> +++ llvm/trunk/lib/Support/Hashing.cpp Thu Aug 30 13:28:32 2018
> @@ -20,10 +20,10 @@ using namespace llvm;
>  // Provide a definition and static initializer for the fixed seed. This
>  // initializer should always be zero to ensure its value can never appear
> to be
>  // non-zero, even during dynamic initialization.
> -size_t llvm::hashing::detail::fixed_seed_override = 0;
> +uint64_t llvm::hashing::detail::fixed_seed_override = 0;
>
>  // Implement the function for forced setting of the fixed seed.
>  // FIXME: Use atomic operations here so that there is no data race.
> -void llvm::set_fixed_execution_hash_seed(size_t fixed_value) {
> +void llvm::set_fixed_execution_hash_seed(uint64_t fixed_value) {
>    hashing::detail::fixed_seed_override = fixed_value;
>  }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180831/dca81b27/attachment.html>


More information about the llvm-commits mailing list