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

Chris Lattner clattner at apple.com
Thu Jan 18 13:49:28 PST 2007


Please just use uint64_t BitMask = Ty->getIntegerTypeMask();

Thanks,

-Chris


On Jan 18, 2007, at 10:01 AM, Reid Spencer wrote:

>
>
> 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;
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list