diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2012-03-02 10:56:40 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2012-03-02 10:56:40 +0000 |
commit | 1c1448984d43f1f02c0235d35ebe8460c9b57afd (patch) | |
tree | c15c8c05b0a683a2653c6d0e61edb9f04dc042bc /include/llvm/ADT | |
parent | d8313be41031e4d768f5b38199904d4debff88cd (diff) | |
download | external_llvm-1c1448984d43f1f02c0235d35ebe8460c9b57afd.zip external_llvm-1c1448984d43f1f02c0235d35ebe8460c9b57afd.tar.gz external_llvm-1c1448984d43f1f02c0235d35ebe8460c9b57afd.tar.bz2 |
Simplify the pair optimization. Rather than using complex type traits,
just ensure that the number of bytes in the pair is the sum of the bytes
in each side of the pair. As long as thats true, there are no extra
bytes that might be padding.
Also add a few tests that previously would have slipped through the
checking. The more accurate checking mechanism catches these and ensures
they are handled conservatively correctly.
Thanks to Duncan for prodding me to do this right and more simply.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151891 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r-- | include/llvm/ADT/Hashing.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/llvm/ADT/Hashing.h b/include/llvm/ADT/Hashing.h index 1b0e669..7fbe5bb 100644 --- a/include/llvm/ADT/Hashing.h +++ b/include/llvm/ADT/Hashing.h @@ -357,8 +357,8 @@ template <typename T> struct is_hashable_data template <typename T, typename U> struct is_hashable_data<std::pair<T, U> > : integral_constant<bool, (is_hashable_data<T>::value && is_hashable_data<U>::value && - !is_alignment_padded<std::pair<T, U> >::value && - !is_pod_pair_padded<T, U>::value)> {}; + (sizeof(T) + sizeof(U)) == + sizeof(std::pair<T, U>))> {}; /// \brief Helper to get the hashable data representation for a type. /// This variant is enabled when the type itself can be used. |