summaryrefslogtreecommitdiffstats
path: root/llvm/lib
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
commite62c89a9f55bed384d031b7d18b5c0d3a843cabf (patch)
tree41296f9d58a87b539885e2561b1d3ed0a82bd0ad /llvm/lib
parentecb38495af523fd7d2a477e7ee50f52ab3d0f74f (diff)
downloadbcm5719-llvm-e62c89a9f55bed384d031b7d18b5c0d3a843cabf.tar.gz
bcm5719-llvm-e62c89a9f55bed384d031b7d18b5c0d3a843cabf.zip
Fix Transforms/ConstProp/2007-02-05-BitCast.ll
llvm-svn: 33948
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/VMCore/ConstantFolding.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/VMCore/ConstantFolding.cpp b/llvm/lib/VMCore/ConstantFolding.cpp
index 41078d97f1d..a540f4e3944 100644
--- a/llvm/lib/VMCore/ConstantFolding.cpp
+++ b/llvm/lib/VMCore/ConstantFolding.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:
OpenPOWER on IntegriCloud