aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/FoldingSet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Support/FoldingSet.cpp')
-rw-r--r--lib/Support/FoldingSet.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Support/FoldingSet.cpp b/lib/Support/FoldingSet.cpp
index 1b0e81e466..ecb700dfd6 100644
--- a/lib/Support/FoldingSet.cpp
+++ b/lib/Support/FoldingSet.cpp
@@ -44,7 +44,10 @@ void FoldingSetImpl::NodeID::AddInteger(unsigned I) {
}
void FoldingSetImpl::NodeID::AddInteger(uint64_t I) {
Bits.push_back(unsigned(I));
- Bits.push_back(unsigned(I >> 32));
+
+ // If the integer is small, encode it just as 32-bits.
+ if ((uint64_t)(int)I != I)
+ Bits.push_back(unsigned(I >> 32));
}
void FoldingSetImpl::NodeID::AddFloat(float F) {
Bits.push_back(FloatToBits(F));