diff options
-rw-r--r-- | include/llvm/ADT/ImmutableSet.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/llvm/ADT/ImmutableSet.h b/include/llvm/ADT/ImmutableSet.h index 1172460..9f08b03 100644 --- a/include/llvm/ADT/ImmutableSet.h +++ b/include/llvm/ADT/ImmutableSet.h @@ -231,9 +231,12 @@ private: } inline unsigned ComputeHash() { - if (!isMutable() && Hash) return Hash; - Hash = ComputeHash(getSafeLeft(), getRight(), getValue()); - return Hash; + if (Hash) return Hash; + + unsigned X = ComputeHash(getSafeLeft(), getRight(), getValue()); + if (!isMutable()) Hash = X; + + return X; } /// Profile - Generates a FoldingSet profile for a tree node before it is |