diff options
Diffstat (limited to 'lib/VMCore/ConstantFold.cpp')
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 5f7cbcd0b6..ff4d897e54 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -161,17 +161,12 @@ static Constant *FoldBitCast(Constant *V, const Type *DestTy) { // Otherwise, can't fold this (vector?) return 0; } - + // Handle ConstantFP input. - if (const ConstantFP *FP = dyn_cast<ConstantFP>(V)) { + if (const ConstantFP *FP = dyn_cast<ConstantFP>(V)) // FP -> Integral. - if (DestTy == Type::Int32Ty) { - return ConstantInt::get(FP->getValueAPF().bitcastToAPInt()); - } else { - assert(DestTy == Type::Int64Ty && "only support f32/f64 for now!"); - return ConstantInt::get(FP->getValueAPF().bitcastToAPInt()); - } - } + return ConstantInt::get(FP->getValueAPF().bitcastToAPInt()); + return 0; } |