diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-12-11 21:27:28 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-12-11 21:27:28 +0000 |
commit | 8c4fed50e3f4318baadf88bbbaa9313a6616493b (patch) | |
tree | d3fe80659d80bd730ace416c3d4094a743362112 | |
parent | 6a126513fc82c5871d0785cc5fc9c89ce8c9055d (diff) |
Fix constant folding of FP->int due to cut & paste error in last commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32447 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/ConstantFold.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/VMCore/ConstantFold.cpp b/lib/VMCore/ConstantFold.cpp index 7eb7d4d8f8..bad774e67f 100644 --- a/lib/VMCore/ConstantFold.cpp +++ b/lib/VMCore/ConstantFold.cpp @@ -983,9 +983,10 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V, if (const ConstantFP *FP = dyn_cast<ConstantFP>(V)) { // FP -> Integral. if (DestTy->isIntegral()) { - if (DestTy == Type::FloatTy) + if (DestTy == Type::IntTy || DestTy == Type::UIntTy) return ConstantInt::get(DestTy, FloatToBits(FP->getValue())); - assert(DestTy == Type::DoubleTy && "Unknown FP type!"); + assert((DestTy == Type::LongTy || DestTy == Type::ULongTy) + && "Incorrect integer type for bitcast!"); return ConstantInt::get(DestTy, DoubleToBits(FP->getValue())); } } |