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

Chris Lattner clattner at apple.com
Tue Feb 27 14:19:36 PST 2007


> @@ -464,7 +464,7 @@
>      if (CI->getType() == Type::Int1Ty)
>        Out << (CI->getZExtValue() ? "true" : "false");
>      else
> -      Out << CI->getValue().toString(10,/*wantSigned=*/true);
> +      Out << CI->getValue().toStringSigned(10);

Thanks!

>    case Instruction::UIToFP:
>      if (const ConstantInt *CI = dyn_cast<ConstantInt>(V))
> -      if (CI->getType()->getBitWidth() <= APInt::APINT_BITS_PER_WORD)
> -        return ConstantFP::get(DestTy, CI->getValue().roundToDouble 
> (false));
> +      if (CI->getType()->getBitWidth() <= 64)
> +        return ConstantFP::get(DestTy, CI->getValue().roundToDouble 
> ());
>      return 0;
>    case Instruction::SIToFP:
>      if (const ConstantInt *CI = dyn_cast<ConstantInt>(V))
> -      if (CI->getType()->getBitWidth() <= APInt::APINT_BITS_PER_WORD)
> -        return ConstantFP::get(DestTy, CI->getValue().roundToDouble 
> (true));
> +      if (CI->getType()->getBitWidth() <= 64)
> +        return ConstantFP::get(DestTy, CI->getValue 
> ().signedRoundToDouble());
>      return 0;

Okay, I'm still not seeing why "64 and less" can be constant folded,  
but larger things can't...

-Chris



More information about the llvm-commits mailing list