[llvm-commits] CVS: llvm/lib/ExecutionEngine/ExecutionEngine.cpp

Reid Spencer reid at x10sys.com
Thu Jan 18 10:01:58 PST 2007



Changes in directory llvm/lib/ExecutionEngine:

ExecutionEngine.cpp updated: 1.99 -> 1.100
---
Log message:

Fix a regression in the last patch. When constructing a BitMask, be careful
not to overflow 64-bits and end up with a 0 mask. This caused i64 values to
always be stored as 0 with lots of consequential damage to nightly test.


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

 ExecutionEngine.cpp |    4 ++++
 1 files changed, 4 insertions(+)


Index: llvm/lib/ExecutionEngine/ExecutionEngine.cpp
diff -u llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.99 llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.100
--- llvm/lib/ExecutionEngine/ExecutionEngine.cpp:1.99	Wed Jan 17 19:24:02 2007
+++ llvm/lib/ExecutionEngine/ExecutionEngine.cpp	Thu Jan 18 12:01:32 2007
@@ -457,6 +457,8 @@
     case Type::IntegerTyID: {
       unsigned BitWidth = cast<IntegerType>(Ty)->getBitWidth();
       uint64_t BitMask = (1ull << BitWidth) - 1;
+      if (BitWidth >= 64)
+        BitMask = (uint64_t)-1;
       GenericValue TmpVal = Val;
       if (BitWidth <= 8)
         Ptr->Untyped[0] = Val.Int8Val & BitMask;
@@ -513,6 +515,8 @@
     case Type::IntegerTyID: {
       unsigned BitWidth = cast<IntegerType>(Ty)->getBitWidth();
       uint64_t BitMask = (1ull << BitWidth) - 1;
+      if (BitWidth >= 64)
+        BitMask = (uint64_t)-1;
       GenericValue TmpVal = Val;
       if (BitWidth <= 8)
         Ptr->Untyped[0] = Val.Int8Val & BitMask;






More information about the llvm-commits mailing list