diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-10-16 17:49:09 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-10-16 17:49:09 +0000 |
commit | e3a9a676f9e3000662c05ff35a3b4312e04b5ee2 (patch) | |
tree | 2d733fa5c64945bc3a7ce34986d92327baffef35 /llvm/lib/Support/FoldingSet.cpp | |
parent | 62ce463a35d7d0dd919672a0a824352b1847de06 (diff) | |
download | bcm5719-llvm-e3a9a676f9e3000662c05ff35a3b4312e04b5ee2.tar.gz bcm5719-llvm-e3a9a676f9e3000662c05ff35a3b4312e04b5ee2.zip |
PR30711: Fix incorrect profiling of 'long long' in FoldingSet, then use it to
fix TBAA violation in profiling of pointers.
llvm-svn: 284336
Diffstat (limited to 'llvm/lib/Support/FoldingSet.cpp')
-rw-r--r-- | llvm/lib/Support/FoldingSet.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Support/FoldingSet.cpp b/llvm/lib/Support/FoldingSet.cpp index a27d3174a4f..c9bca7f4c1a 100644 --- a/llvm/lib/Support/FoldingSet.cpp +++ b/llvm/lib/Support/FoldingSet.cpp @@ -54,8 +54,9 @@ void FoldingSetNodeID::AddPointer(const void *Ptr) { // depend on the host. It doesn't matter, however, because hashing on // pointer values is inherently unstable. Nothing should depend on the // ordering of nodes in the folding set. - Bits.append(reinterpret_cast<unsigned *>(&Ptr), - reinterpret_cast<unsigned *>(&Ptr+1)); + static_assert(sizeof(uintptr_t) <= sizeof(unsigned long long), + "unexpected pointer size"); + AddInteger(reinterpret_cast<uintptr_t>(Ptr)); } void FoldingSetNodeID::AddInteger(signed I) { Bits.push_back(I); @@ -80,8 +81,7 @@ void FoldingSetNodeID::AddInteger(long long I) { } void FoldingSetNodeID::AddInteger(unsigned long long I) { AddInteger(unsigned(I)); - if ((uint64_t)(unsigned)I != I) - Bits.push_back(unsigned(I >> 32)); + AddInteger(unsigned(I >> 32)); } void FoldingSetNodeID::AddString(StringRef String) { |