On Mon, 2007-03-12 at 12:48 -0500, Zhou Sheng wrote:
> 
> Changes in directory llvm/lib/Support:
> 
> APInt.cpp updated: 1.69 -> 1.70
> ---
> Log message:
> 
> For APInt::z/sext(width), if width == BitWidth, just return *this.

Sheng, this is incorrect. It is not legal to use sext/zext with a bit
width that is equal to the bit width of the APInt. Please see the
definition of sext/zext in the language reference. APInt must implement
the same operations (and restrictions on them) as the instructions do.
In the future, please consult with me before making this kind of
change. 

I have reverted this patch.

Reid.

> 
> 
> ---
> Diffs of the changes:  (+4 -0)
> 
>  APInt.cpp |    4 ++++
>  1 files changed, 4 insertions(+)
> 
> 
> Index: llvm/lib/Support/APInt.cpp
> diff -u llvm/lib/Support/APInt.cpp:1.69 llvm/lib/Support/APInt.cpp:1.70
> --- llvm/lib/Support/APInt.cpp:1.69   Sun Mar  4 18:00:42 2007
> +++ llvm/lib/Support/APInt.cpp        Mon Mar 12 12:47:45 2007
> @@ -921,6 +921,8 @@
>  
>  // Sign extend to a new width.
>  APInt &APInt::sext(uint32_t width) {
> +  if (width == BitWidth)
> +    return *this;
>    assert(width > BitWidth && "Invalid APInt SignExtend request");
>    assert(width <= IntegerType::MAX_INT_BITS && "Too many bits");
>    // If the sign bit isn't set, this is the same as zext.
> @@ -969,6 +971,8 @@
>  
>  //  Zero extend to a new width.
>  APInt &APInt::zext(uint32_t width) {
> +  if (width == BitWidth)
> +    return *this;
>    assert(width > BitWidth && "Invalid APInt ZeroExtend request");
>    assert(width <= IntegerType::MAX_INT_BITS && "Too many bits");
>    uint32_t wordsBefore = getNumWords();
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to