[llvm-commits] [llvm] r47744 - /llvm/trunk/lib/VMCore/ConstantFold.cpp
Dan Gohman
gohman at apple.com
Thu Feb 28 17:42:52 PST 2008
Author: djg
Date: Thu Feb 28 19:42:52 2008
New Revision: 47744
URL: http://llvm.org/viewvc/llvm-project?rev=47744&view=rev
Log:
Use the new convertFromAPInt instead of convertFromZeroExtendedInteger.
Modified:
llvm/trunk/lib/VMCore/ConstantFold.cpp
Modified: llvm/trunk/lib/VMCore/ConstantFold.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/ConstantFold.cpp?rev=47744&r1=47743&r2=47744&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/ConstantFold.cpp (original)
+++ llvm/trunk/lib/VMCore/ConstantFold.cpp Thu Feb 28 19:42:52 2008
@@ -170,8 +170,6 @@
Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
const Type *DestTy) {
- const Type *SrcTy = V->getType();
-
if (isa<UndefValue>(V)) {
// zext(undef) = 0, because the top bits will be zero.
// sext(undef) = 0, because the top bits will all be the same.
@@ -257,12 +255,11 @@
if (const ConstantInt *CI = dyn_cast<ConstantInt>(V)) {
APInt api = CI->getValue();
const uint64_t zero[] = {0, 0};
- uint32_t BitWidth = cast<IntegerType>(SrcTy)->getBitWidth();
APFloat apf = APFloat(APInt(DestTy->getPrimitiveSizeInBits(),
2, zero));
- (void)apf.convertFromZeroExtendedInteger(api.getRawData(), BitWidth,
- opc==Instruction::SIToFP,
- APFloat::rmNearestTiesToEven);
+ (void)apf.convertFromAPInt(api,
+ opc==Instruction::SIToFP,
+ APFloat::rmNearestTiesToEven);
return ConstantFP::get(DestTy, apf);
}
if (const ConstantVector *CV = dyn_cast<ConstantVector>(V)) {
More information about the llvm-commits
mailing list