diff options
| author | Reid Spencer <rspencer@reidspencer.com> | 2007-01-18 18:01:32 +0000 |
|---|---|---|
| committer | Reid Spencer <rspencer@reidspencer.com> | 2007-01-18 18:01:32 +0000 |
| commit | 726b68bc6e12311067648b623d72248f94b187cd (patch) | |
| tree | df9b9b5c7085a9f8494ce632ef880935a372442d /llvm/lib | |
| parent | 889d934d002005ec98e3897b430ec6f73031dd63 (diff) | |
| download | bcm5719-llvm-726b68bc6e12311067648b623d72248f94b187cd.tar.gz bcm5719-llvm-726b68bc6e12311067648b623d72248f94b187cd.zip | |
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.
llvm-svn: 33335
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/ExecutionEngine/ExecutionEngine.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp index 2cb4a8ef964..771ce0b1aa3 100644 --- a/llvm/lib/ExecutionEngine/ExecutionEngine.cpp +++ b/llvm/lib/ExecutionEngine/ExecutionEngine.cpp @@ -457,6 +457,8 @@ void ExecutionEngine::StoreValueToMemory(GenericValue Val, GenericValue *Ptr, 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 @@ Store4BytesLittleEndian: 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; |

