[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp

Chris Lattner clattner at apple.com
Mon Dec 11 13:30:09 PST 2006


Thanks Reid!

-Chris

On Dec 11, 2006, at 1:27 PM, Reid Spencer wrote:

>
>
> Changes in directory llvm/lib/VMCore:
>
> ConstantFolding.cpp updated: 1.112 -> 1.113
> ---
> Log message:
>
> Fix constant folding of FP->int due to cut & paste error in last  
> commit.
>
>
> ---
> Diffs of the changes:  (+3 -2)
>
>  ConstantFolding.cpp |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
>
> Index: llvm/lib/VMCore/ConstantFolding.cpp
> diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.112 llvm/lib/VMCore/ 
> ConstantFolding.cpp:1.113
> --- llvm/lib/VMCore/ConstantFolding.cpp:1.112	Mon Dec 11 12:30:27 2006
> +++ llvm/lib/VMCore/ConstantFolding.cpp	Mon Dec 11 15:27:28 2006
> @@ -983,9 +983,10 @@
>      if (const ConstantFP *FP = dyn_cast<ConstantFP>(V)) {
>        // FP -> Integral.
>        if (DestTy->isIntegral()) {
> -        if (DestTy == Type::FloatTy)
> +        if (DestTy == Type::IntTy || DestTy == Type::UIntTy)
>            return ConstantInt::get(DestTy, FloatToBits(FP->getValue 
> ()));
> -        assert(DestTy == Type::DoubleTy && "Unknown FP type!");
> +        assert((DestTy == Type::LongTy || DestTy == Type::ULongTy)
> +               && "Incorrect integer  type for bitcast!");
>          return ConstantInt::get(DestTy, DoubleToBits(FP->getValue 
> ()));
>        }
>      }
>
>
>
> _______________________________________________
> 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