[llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp

Chris Lattner sabre at nondot.org
Sat Feb 3 17:48:26 PST 2007



Changes in directory llvm/lib/Support:

FoldingSet.cpp updated: 1.15 -> 1.16
---
Log message:

Encode small integers more densely in foldingset, avoiding overflowing the SmallVector as often.


---
Diffs of the changes:  (+4 -1)

 FoldingSet.cpp |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)


Index: llvm/lib/Support/FoldingSet.cpp
diff -u llvm/lib/Support/FoldingSet.cpp:1.15 llvm/lib/Support/FoldingSet.cpp:1.16
--- llvm/lib/Support/FoldingSet.cpp:1.15	Wed Jan 31 23:33:21 2007
+++ llvm/lib/Support/FoldingSet.cpp	Sat Feb  3 19:48:10 2007
@@ -44,7 +44,10 @@
 }
 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));






More information about the llvm-commits mailing list