summaryrefslogtreecommitdiff
path: root/lib/VMCore/ConstantFold.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-06 02:22:56 +0000
committerChris Lattner <sabre@nondot.org>2007-02-06 02:22:56 +0000
commit775bd830505c01d9cd8c53e4670bc3c0b78ab47b (patch)
treefda2089032d406c284463b74a839a05d86819904 /lib/VMCore/ConstantFold.cpp
parent37d94b42a74eb635e180fadc30881d0be998a3b1 (diff)
downloadllvm-775bd830505c01d9cd8c53e4670bc3c0b78ab47b.tar.gz
llvm-775bd830505c01d9cd8c53e4670bc3c0b78ab47b.tar.bz2
llvm-775bd830505c01d9cd8c53e4670bc3c0b78ab47b.tar.xz
Fix Transforms/ConstProp/2007-02-05-BitCast.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33948 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r--lib/VMCore/ConstantFold.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp
index 41078d97f1..a540f4e394 100644
--- a/lib/VMCore/ConstantFold.cpp
+++ b/lib/VMCore/ConstantFold.cpp
@@ -296,8 +296,12 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
// Handle ConstantFP input.
if (const ConstantFP *FP = dyn_cast<ConstantFP>(V)) {
// FP -> Integral.
- if (DestTy->isInteger())
+ if (DestTy == Type::Int32Ty) {
+ return ConstantInt::get(DestTy, FloatToBits(FP->getValue()));
+ } else {
+ assert(DestTy == Type::Int64Ty && "only support f32/f64 for now!");
return ConstantInt::get(DestTy, DoubleToBits(FP->getValue()));
+ }
}
return 0;
default: