summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-02-29 01:42:52 +0000
committerDan Gohman <gohman@apple.com>2008-02-29 01:42:52 +0000
commit06c45d516d5079e3fc989efda70ff3ead70a54c7 (patch)
tree135d8a5d4bf2688c6ae5f9a3de2ad320cf43f3bd
parentec6be4a782100fe817227f9abe525703a6de1b0a (diff)
downloadbcm5719-llvm-06c45d516d5079e3fc989efda70ff3ead70a54c7.tar.gz
bcm5719-llvm-06c45d516d5079e3fc989efda70ff3ead70a54c7.zip
Use the new convertFromAPInt instead of convertFromZeroExtendedInteger.
llvm-svn: 47744
-rw-r--r--llvm/lib/VMCore/ConstantFold.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/llvm/lib/VMCore/ConstantFold.cpp b/llvm/lib/VMCore/ConstantFold.cpp
index 451190fc94a..762a24a2633 100644
--- a/llvm/lib/VMCore/ConstantFold.cpp
+++ b/llvm/lib/VMCore/ConstantFold.cpp
@@ -170,8 +170,6 @@ static Constant *FoldBitCast(Constant *V, const Type *DestTy) {
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 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
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)) {
OpenPOWER on IntegriCloud