Fix constant folding of FP->int due to cut & paste error in last commit.
authorReid Spencer <rspencer@reidspencer.com>
Mon, 11 Dec 2006 21:27:28 +0000 (21:27 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Mon, 11 Dec 2006 21:27:28 +0000 (21:27 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32447 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/ConstantFold.cpp

index 7eb7d4d8f8b6f026269347ec5b0fa2e6eb8a3582..bad774e67fdebaaca0f8fdcfebc863f56e7c38c9 100644 (file)
@@ -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()));
       }
     }