summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-04 01:48:10 +0000
committerChris Lattner <sabre@nondot.org>2007-02-04 01:48:10 +0000
commit010ee96261e37ccd8edab67d702870724039cbc1 (patch)
tree28f06d788e1a3da1258ad596eef12eff9317fd35
parent289aa4495cc18e7a3ab2100005be48d64483b44c (diff)
downloadbcm5719-llvm-010ee96261e37ccd8edab67d702870724039cbc1.tar.gz
bcm5719-llvm-010ee96261e37ccd8edab67d702870724039cbc1.zip
Encode small integers more densely in foldingset, avoiding overflowing the SmallVector as often.
llvm-svn: 33864
-rw-r--r--llvm/lib/Support/FoldingSet.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Support/FoldingSet.cpp b/llvm/lib/Support/FoldingSet.cpp
index 1b0e81e466f..ecb700dfd61 100644
--- a/llvm/lib/Support/FoldingSet.cpp
+++ b/llvm/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));
OpenPOWER on IntegriCloud