Rename APFloat::convertToAPInt to bitcastToAPInt to
authorDale Johannesen <dalej@apple.com>
Thu, 9 Oct 2008 18:53:47 +0000 (18:53 +0000)
committerDale Johannesen <dalej@apple.com>
Thu, 9 Oct 2008 18:53:47 +0000 (18:53 +0000)
make it clearer what the function does.  No functional
change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57325 91177308-0d34-0410-b5e6-96231b3b80d8

15 files changed:
include/llvm/ADT/APFloat.h
lib/Bitcode/Writer/BitcodeWriter.cpp
lib/Bitcode/Writer/SerializeAPFloat.cpp
lib/CodeGen/AsmPrinter/AsmPrinter.cpp
lib/CodeGen/MachOWriter.cpp
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp
lib/ExecutionEngine/ExecutionEngine.cpp
lib/Support/APFloat.cpp
lib/Target/CBackend/CBackend.cpp
lib/Target/CppBackend/CPPBackend.cpp
lib/Target/MSIL/MSILWriter.cpp
lib/VMCore/AsmWriter.cpp
lib/VMCore/ConstantFold.cpp

index fc5203c546f33d11a014c01d112ab66755623e40..8566a5783903e051541d28c04c5526bca463e5ba 100644 (file)
@@ -129,7 +129,7 @@ namespace llvm {
     static const fltSemantics IEEEquad;
     static const fltSemantics PPCDoubleDouble;
     static const fltSemantics x87DoubleExtended;
-    /* And this psuedo, used to construct APFloats that cannot
+    /* And this pseudo, used to construct APFloats that cannot
        conflict with anything real. */
     static const fltSemantics Bogus;
 
@@ -226,7 +226,7 @@ namespace llvm {
     opStatus convertFromZeroExtendedInteger(const integerPart *, unsigned int,
                                             bool, roundingMode);
     opStatus convertFromString(const char *, roundingMode);
-    APInt convertToAPInt() const;
+    APInt bitcastToAPInt() const;
     double convertToDouble() const;
     float convertToFloat() const;
 
@@ -239,6 +239,9 @@ namespace llvm {
        compare unordered, 0==-0). */
     cmpResult compare(const APFloat &) const;
 
+    /* Bitwise comparison for equality (QNaNs compare equal, 0!=-0). */
+    bool bitwiseIsEqual(const APFloat &) const;
+
     /* Write out a hexadecimal representation of the floating point
        value to DST, which must be of sufficient size, in the C99 form
        [-]0xh.hhhhp[+-]d.  Return the number of characters written,
@@ -246,9 +249,6 @@ namespace llvm {
     unsigned int convertToHexString(char *dst, unsigned int hexDigits,
                                     bool upperCase, roundingMode) const;
 
-    /* Bitwise comparison for equality (QNaNs compare equal, 0!=-0). */
-    bool bitwiseIsEqual(const APFloat &) const;
-
     /* Simple queries.  */
     fltCategory getCategory() const { return category; }
     const fltSemantics &getSemantics() const { return *semantics; }
index 4b0664e27b577b8518cbddda2d0546f5e10224e0..408a352bcffc5b9cd843e80295da7eea751714aa 100644 (file)
@@ -542,15 +542,15 @@ static void WriteConstants(unsigned FirstVal, unsigned LastVal,
       Code = bitc::CST_CODE_FLOAT;
       const Type *Ty = CFP->getType();
       if (Ty == Type::FloatTy || Ty == Type::DoubleTy) {
-        Record.push_back(CFP->getValueAPF().convertToAPInt().getZExtValue());
+        Record.push_back(CFP->getValueAPF().bitcastToAPInt().getZExtValue());
       } else if (Ty == Type::X86_FP80Ty) {
         // api needed to prevent premature destruction
-        APInt api = CFP->getValueAPF().convertToAPInt();
+        APInt api = CFP->getValueAPF().bitcastToAPInt();
         const uint64_t *p = api.getRawData();
         Record.push_back(p[0]);
         Record.push_back((uint16_t)p[1]);
       } else if (Ty == Type::FP128Ty || Ty == Type::PPC_FP128Ty) {
-        APInt api = CFP->getValueAPF().convertToAPInt();
+        APInt api = CFP->getValueAPF().bitcastToAPInt();
         const uint64_t *p = api.getRawData();
         Record.push_back(p[0]);
         Record.push_back(p[1]);
index 0e644522b10ec091623fbebdad131bb38b5323e6..25d954faa138deb72616e76067a97ed78a416318 100644 (file)
@@ -17,5 +17,5 @@
 using namespace llvm;
 
 void APFloat::Emit(Serializer& S) const {
-  S.Emit(convertToAPInt());
+  S.Emit(bitcastToAPInt());
 }
index 801bd1b1fa3b8be80814768f223beaa74395810d..1321c040d11b577039666c9c1aa2422ba61017ec 100644 (file)
@@ -969,7 +969,7 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) {
     // precision...
     if (CFP->getType() == Type::DoubleTy) {
       double Val = CFP->getValueAPF().convertToDouble();  // for comment only
-      uint64_t i = CFP->getValueAPF().convertToAPInt().getZExtValue();
+      uint64_t i = CFP->getValueAPF().bitcastToAPInt().getZExtValue();
       if (TAI->getData64bitsDirective())
         O << TAI->getData64bitsDirective() << i << '\t'
           << TAI->getCommentString() << " double value: " << Val << '\n';
@@ -992,13 +992,13 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) {
     } else if (CFP->getType() == Type::FloatTy) {
       float Val = CFP->getValueAPF().convertToFloat();  // for comment only
       O << TAI->getData32bitsDirective()
-        << CFP->getValueAPF().convertToAPInt().getZExtValue()
+        << CFP->getValueAPF().bitcastToAPInt().getZExtValue()
         << '\t' << TAI->getCommentString() << " float " << Val << '\n';
       return;
     } else if (CFP->getType() == Type::X86_FP80Ty) {
       // all long double variants are printed as hex
       // api needed to prevent premature destruction
-      APInt api = CFP->getValueAPF().convertToAPInt();
+      APInt api = CFP->getValueAPF().bitcastToAPInt();
       const uint64_t *p = api.getRawData();
       APFloat DoubleVal = CFP->getValueAPF();
       DoubleVal.convert(APFloat::IEEEdouble, APFloat::rmNearestTiesToEven);
@@ -1042,7 +1042,7 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) {
     } else if (CFP->getType() == Type::PPC_FP128Ty) {
       // all long double variants are printed as hex
       // api needed to prevent premature destruction
-      APInt api = CFP->getValueAPF().convertToAPInt();
+      APInt api = CFP->getValueAPF().bitcastToAPInt();
       const uint64_t *p = api.getRawData();
       if (TD->isBigEndian()) {
         O << TAI->getData32bitsDirective() << uint32_t(p[0] >> 32)
index 253c5ca5f4609337f4fdb1762b97880ede0ce806..e90f1e9c1055c6e31861bf2d1f850b22ae832947 100644 (file)
@@ -878,7 +878,7 @@ void MachOWriter::InitMem(const Constant *C, void *Addr, intptr_t Offset,
         break;
       }
       case Type::FloatTyID: {
-        uint32_t val = cast<ConstantFP>(PC)->getValueAPF().convertToAPInt().
+        uint32_t val = cast<ConstantFP>(PC)->getValueAPF().bitcastToAPInt().
                         getZExtValue();
         if (TD->isBigEndian())
           val = ByteSwap_32(val);
@@ -889,7 +889,7 @@ void MachOWriter::InitMem(const Constant *C, void *Addr, intptr_t Offset,
         break;
       }
       case Type::DoubleTyID: {
-        uint64_t val = cast<ConstantFP>(PC)->getValueAPF().convertToAPInt().
+        uint64_t val = cast<ConstantFP>(PC)->getValueAPF().bitcastToAPInt().
                          getZExtValue();
         if (TD->isBigEndian())
           val = ByteSwap_64(val);
index 22145122d557e14eaed4a7459f2392ff26a5328d..c774c6878d1fd2ff8013996881a5a0729d96a72d 100644 (file)
@@ -4630,7 +4630,7 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
         if ((!AfterLegalize && !ST->isVolatile()) ||
             TLI.isOperationLegal(ISD::STORE, MVT::i32)) {
           Tmp = DAG.getConstant((uint32_t)CFP->getValueAPF().
-                              convertToAPInt().getZExtValue(), MVT::i32);
+                              bitcastToAPInt().getZExtValue(), MVT::i32);
           return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(),
                               ST->getSrcValueOffset(), ST->isVolatile(),
                               ST->getAlignment());
@@ -4639,7 +4639,7 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
       case MVT::f64:
         if ((!AfterLegalize && !ST->isVolatile()) ||
             TLI.isOperationLegal(ISD::STORE, MVT::i64)) {
-          Tmp = DAG.getConstant(CFP->getValueAPF().convertToAPInt().
+          Tmp = DAG.getConstant(CFP->getValueAPF().bitcastToAPInt().
                                   getZExtValue(), MVT::i64);
           return DAG.getStore(Chain, Tmp, Ptr, ST->getSrcValue(),
                               ST->getSrcValueOffset(), ST->isVolatile(),
@@ -4649,7 +4649,7 @@ SDValue DAGCombiner::visitSTORE(SDNode *N) {
           // Many FP stores are not made apparent until after legalize, e.g. for
           // argument passing.  Since this is so common, custom legalize the
           // 64-bit integer store into two 32-bit stores.
-          uint64_t Val = CFP->getValueAPF().convertToAPInt().getZExtValue();
+          uint64_t Val = CFP->getValueAPF().bitcastToAPInt().getZExtValue();
           SDValue Lo = DAG.getConstant(Val & 0xFFFFFFFF, MVT::i32);
           SDValue Hi = DAG.getConstant(Val >> 32, MVT::i32);
           if (TLI.isBigEndian()) std::swap(Lo, Hi);
index 8874eb872f6042d9b0add6e9189eaf124dfd12a8..b7311b7d9e813a6bbf8b3305a9e21ba95fc5155c 100644 (file)
@@ -445,7 +445,7 @@ static SDValue ExpandConstantFP(ConstantFPSDNode *CFP, bool UseCP,
   if (!UseCP) {
     if (VT!=MVT::f64 && VT!=MVT::f32)
       assert(0 && "Invalid type expansion");
-    return DAG.getConstant(LLVMC->getValueAPF().convertToAPInt(),
+    return DAG.getConstant(LLVMC->getValueAPF().bitcastToAPInt(),
                            (VT == MVT::f64) ? MVT::i64 : MVT::i32);
   }
 
@@ -2357,7 +2357,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
         if (CFP->getValueType(0) == MVT::f32 && 
             getTypeAction(MVT::i32) == Legal) {
           Tmp3 = DAG.getConstant(CFP->getValueAPF().
-                                          convertToAPInt().zextOrTrunc(32),
+                                          bitcastToAPInt().zextOrTrunc(32),
                                   MVT::i32);
           Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(),
                                 SVOffset, isVolatile, Alignment);
@@ -2365,7 +2365,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
         } else if (CFP->getValueType(0) == MVT::f64) {
           // If this target supports 64-bit registers, do a single 64-bit store.
           if (getTypeAction(MVT::i64) == Legal) {
-            Tmp3 = DAG.getConstant(CFP->getValueAPF().convertToAPInt().
+            Tmp3 = DAG.getConstant(CFP->getValueAPF().bitcastToAPInt().
                                      zextOrTrunc(64), MVT::i64);
             Result = DAG.getStore(Tmp1, Tmp3, Tmp2, ST->getSrcValue(),
                                   SVOffset, isVolatile, Alignment);
@@ -2374,7 +2374,7 @@ SDValue SelectionDAGLegalize::LegalizeOp(SDValue Op) {
             // Otherwise, if the target supports 32-bit registers, use 2 32-bit
             // stores.  If the target supports neither 32- nor 64-bits, this
             // xform is certainly not worth it.
-            const APInt &IntVal =CFP->getValueAPF().convertToAPInt();
+            const APInt &IntVal =CFP->getValueAPF().bitcastToAPInt();
             SDValue Lo = DAG.getConstant(APInt(IntVal).trunc(32), MVT::i32);
             SDValue Hi = DAG.getConstant(IntVal.lshr(32).trunc(32), MVT::i32);
             if (TLI.isBigEndian()) std::swap(Lo, Hi);
@@ -5912,7 +5912,7 @@ void SelectionDAGLegalize::ExpandOp(SDValue Op, SDValue &Lo, SDValue &Hi){
   case ISD::ConstantFP: {
     ConstantFPSDNode *CFP = cast<ConstantFPSDNode>(Node);
     if (CFP->getValueType(0) == MVT::ppcf128) {
-      APInt api = CFP->getValueAPF().convertToAPInt();
+      APInt api = CFP->getValueAPF().bitcastToAPInt();
       Lo = DAG.getConstantFP(APFloat(APInt(64, 1, &api.getRawData()[1])),
                              MVT::f64);
       Hi = DAG.getConstantFP(APFloat(APInt(64, 1, &api.getRawData()[0])), 
index 45ae85c8548199f95788a8b2900f7421d34f5ebd..466eedb0db69e0e7901a826d32899cb610b3e847 100644 (file)
@@ -93,7 +93,7 @@ SDValue DAGTypeLegalizer::SoftenFloatRes_BUILD_PAIR(SDNode *N) {
 }
 
 SDValue DAGTypeLegalizer::SoftenFloatRes_ConstantFP(ConstantFPSDNode *N) {
-  return DAG.getConstant(N->getValueAPF().convertToAPInt(),
+  return DAG.getConstant(N->getValueAPF().bitcastToAPInt(),
                          TLI.getTypeToTransformTo(N->getValueType(0)));
 }
 
@@ -586,7 +586,7 @@ void DAGTypeLegalizer::ExpandFloatRes_ConstantFP(SDNode *N, SDValue &Lo,
   MVT NVT = TLI.getTypeToTransformTo(N->getValueType(0));
   assert(NVT.getSizeInBits() == integerPartWidth &&
          "Do not know how to expand this float constant!");
-  APInt C = cast<ConstantFPSDNode>(N)->getValueAPF().convertToAPInt();
+  APInt C = cast<ConstantFPSDNode>(N)->getValueAPF().bitcastToAPInt();
   Lo = DAG.getConstantFP(APFloat(APInt(integerPartWidth, 1,
                                        &C.getRawData()[1])), NVT);
   Hi = DAG.getConstantFP(APFloat(APInt(integerPartWidth, 1,
index 1771ad7a32c1ebb9a48bc7d20bc42bc0151e529d..0731672f8812e6ca510dec560504eb64011d77af 100644 (file)
@@ -467,7 +467,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
         (void)apf.convertFromAPInt(GV.IntVal, 
                                    false,
                                    APFloat::rmNearestTiesToEven);
-        GV.IntVal = apf.convertToAPInt();
+        GV.IntVal = apf.bitcastToAPInt();
       }
       return GV;
     }
@@ -483,7 +483,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
         (void)apf.convertFromAPInt(GV.IntVal, 
                                    true,
                                    APFloat::rmNearestTiesToEven);
-        GV.IntVal = apf.convertToAPInt();
+        GV.IntVal = apf.bitcastToAPInt();
       }
       return GV;
     }
@@ -614,23 +614,23 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
           default: assert(0 && "Invalid long double opcode"); abort();
           case Instruction::Add:  
             apfLHS.add(APFloat(RHS.IntVal), APFloat::rmNearestTiesToEven);
-            GV.IntVal = apfLHS.convertToAPInt();
+            GV.IntVal = apfLHS.bitcastToAPInt();
             break;
           case Instruction::Sub:  
             apfLHS.subtract(APFloat(RHS.IntVal), APFloat::rmNearestTiesToEven);
-            GV.IntVal = apfLHS.convertToAPInt();
+            GV.IntVal = apfLHS.bitcastToAPInt();
             break;
           case Instruction::Mul:  
             apfLHS.multiply(APFloat(RHS.IntVal), APFloat::rmNearestTiesToEven);
-            GV.IntVal = apfLHS.convertToAPInt();
+            GV.IntVal = apfLHS.bitcastToAPInt();
             break;
           case Instruction::FDiv: 
             apfLHS.divide(APFloat(RHS.IntVal), APFloat::rmNearestTiesToEven);
-            GV.IntVal = apfLHS.convertToAPInt();
+            GV.IntVal = apfLHS.bitcastToAPInt();
             break;
           case Instruction::FRem: 
             apfLHS.mod(APFloat(RHS.IntVal), APFloat::rmNearestTiesToEven);
-            GV.IntVal = apfLHS.convertToAPInt();
+            GV.IntVal = apfLHS.bitcastToAPInt();
             break;
           }
         }
@@ -656,7 +656,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
   case Type::X86_FP80TyID:
   case Type::FP128TyID:
   case Type::PPC_FP128TyID:
-    Result.IntVal = cast <ConstantFP>(C)->getValueAPF().convertToAPInt();
+    Result.IntVal = cast <ConstantFP>(C)->getValueAPF().bitcastToAPInt();
     break;
   case Type::IntegerTyID:
     Result.IntVal = cast<ConstantInt>(C)->getValue();
index df309d49c664b36c1270c3dcb81db4bf1f3a34cc..a8691f495ab46638ffac18e1cbf3e2764558777a 100644 (file)
@@ -695,7 +695,7 @@ APFloat::~APFloat()
 
 // Profile - This method 'profiles' an APFloat for use with FoldingSet.
 void APFloat::Profile(FoldingSetNodeID& ID) const {
-  ID.Add(convertToAPInt());
+  ID.Add(bitcastToAPInt());
 }
 
 unsigned int
@@ -2617,7 +2617,7 @@ APFloat::convertFloatAPFloatToAPInt() const
 // and treating the result as a normal integer is unlikely to be useful.
 
 APInt
-APFloat::convertToAPInt() const
+APFloat::bitcastToAPInt() const
 {
   if (semantics == (const llvm::fltSemantics*)&IEEEsingle)
     return convertFloatAPFloatToAPInt();
@@ -2637,7 +2637,7 @@ float
 APFloat::convertToFloat() const
 {
   assert(semantics == (const llvm::fltSemantics*)&IEEEsingle);
-  APInt api = convertToAPInt();
+  APInt api = bitcastToAPInt();
   return api.bitsToFloat();
 }
 
@@ -2645,7 +2645,7 @@ double
 APFloat::convertToDouble() const
 {
   assert(semantics == (const llvm::fltSemantics*)&IEEEdouble);
-  APInt api = convertToAPInt();
+  APInt api = bitcastToAPInt();
   return api.bitsToDouble();
 }
 
index 1700c1eb42ec9a21529d2f223bde3863b66bacdc..96ae40c33943c80094d28cf14c43b8f70b8caa54 100644 (file)
@@ -2028,20 +2028,20 @@ void CWriter::printFloatingPointConstants(Function &F) {
 
         if (FPC->getType() == Type::DoubleTy) {
           double Val = FPC->getValueAPF().convertToDouble();
-          uint64_t i = FPC->getValueAPF().convertToAPInt().getZExtValue();
+          uint64_t i = FPC->getValueAPF().bitcastToAPInt().getZExtValue();
           Out << "static const ConstantDoubleTy FPConstant" << FPCounter++
               << " = 0x" << utohexstr(i)
               << "ULL;    /* " << Val << " */\n";
         } else if (FPC->getType() == Type::FloatTy) {
           float Val = FPC->getValueAPF().convertToFloat();
-          uint32_t i = (uint32_t)FPC->getValueAPF().convertToAPInt().
+          uint32_t i = (uint32_t)FPC->getValueAPF().bitcastToAPInt().
                                     getZExtValue();
           Out << "static const ConstantFloatTy FPConstant" << FPCounter++
               << " = 0x" << utohexstr(i)
               << "U;    /* " << Val << " */\n";
         } else if (FPC->getType() == Type::X86_FP80Ty) {
           // api needed to prevent premature destruction
-          APInt api = FPC->getValueAPF().convertToAPInt();
+          APInt api = FPC->getValueAPF().bitcastToAPInt();
           const uint64_t *p = api.getRawData();
           Out << "static const ConstantFP80Ty FPConstant" << FPCounter++
               << " = { 0x"
@@ -2049,7 +2049,7 @@ void CWriter::printFloatingPointConstants(Function &F) {
               << "ULL, 0x" << utohexstr((uint16_t)(p[0] >> 48)) << ",{0,0,0}"
               << "}; /* Long double constant */\n";
         } else if (FPC->getType() == Type::PPC_FP128Ty) {
-          APInt api = FPC->getValueAPF().convertToAPInt();
+          APInt api = FPC->getValueAPF().bitcastToAPInt();
           const uint64_t *p = api.getRawData();
           Out << "static const ConstantFP128Ty FPConstant" << FPCounter++
               << " = { 0x"
index 75a77a8159e57dae52aaf5f1e1cf1da21d36907a..21e6735b3298032d35ad8b01f8b44bea7abd0f3d 100644 (file)
@@ -254,11 +254,12 @@ namespace {
           Out << StrVal << "f";
       } else if (CFP->getType() == Type::DoubleTy)
         Out << "BitsToDouble(0x"
-            << utohexstr(CFP->getValueAPF().convertToAPInt().getZExtValue())
+            << utohexstr(CFP->getValueAPF().bitcastToAPInt().getZExtValue())
             << "ULL) /* " << StrVal << " */";
       else
         Out << "BitsToFloat(0x"
-      << utohexstr((uint32_t)CFP->getValueAPF().convertToAPInt().getZExtValue())
+            << utohexstr((uint32_t)CFP->getValueAPF().
+                                        bitcastToAPInt().getZExtValue())
             << "U) /* " << StrVal << " */";
       Out << ")";
 #if HAVE_PRINTF_A
index cef8da222cbdd6843cffad4080d0a5d0d87180ef..8e4ca1fcd9710fe2a5f0de03b1b18bf7fce304d9 100644 (file)
@@ -432,10 +432,10 @@ void MSILWriter::printConstLoad(const Constant* C) {
     uint64_t X;
     unsigned Size;
     if (FP->getType()->getTypeID()==Type::FloatTyID) {
-      X = (uint32_t)FP->getValueAPF().convertToAPInt().getZExtValue();
+      X = (uint32_t)FP->getValueAPF().bitcastToAPInt().getZExtValue();
       Size = 4;  
     } else {
-      X = FP->getValueAPF().convertToAPInt().getZExtValue();
+      X = FP->getValueAPF().bitcastToAPInt().getZExtValue();
       Size = 8;  
     }
     Out << "\tldc.r" << Size << "\t( " << utohexstr(X) << ')';
@@ -1477,10 +1477,10 @@ void MSILWriter::printStaticConstant(const Constant* C, uint64_t& Offset) {
     const ConstantFP* FP = cast<ConstantFP>(C);
     if (Ty->getTypeID() == Type::FloatTyID)
       Out << "int32 (" << 
-        (uint32_t)FP->getValueAPF().convertToAPInt().getZExtValue() << ')';
+        (uint32_t)FP->getValueAPF().bitcastToAPInt().getZExtValue() << ')';
     else
       Out << "int64 (" << 
-        FP->getValueAPF().convertToAPInt().getZExtValue() << ')';
+        FP->getValueAPF().bitcastToAPInt().getZExtValue() << ')';
     break;
   }
   case Type::ArrayTyID:
index c3186f69a5ca07e6aaafc8cc38415d877ca0d9f4..4f4f4688d6134295be178ed425fb2ff6cee54ccf 100644 (file)
@@ -738,7 +738,7 @@ static void WriteConstantInt(raw_ostream &Out, const Constant *CV,
     else
       assert(0 && "Unsupported floating point type");
     // api needed to prevent premature destruction
-    APInt api = CFP->getValueAPF().convertToAPInt();
+    APInt api = CFP->getValueAPF().bitcastToAPInt();
     const uint64_t* p = api.getRawData();
     uint64_t word = *p;
     int shiftcount=60;
index 93cfccf1f5e672f7f06ecf02e9a4ef392de2f8bf..92561096d5dc1440acb9045acb3f26a01d97f191 100644 (file)
@@ -160,10 +160,10 @@ static Constant *FoldBitCast(Constant *V, const Type *DestTy) {
   if (const ConstantFP *FP = dyn_cast<ConstantFP>(V)) {
     // FP -> Integral.
     if (DestTy == Type::Int32Ty) {
-      return ConstantInt::get(FP->getValueAPF().convertToAPInt());
+      return ConstantInt::get(FP->getValueAPF().bitcastToAPInt());
     } else {
       assert(DestTy == Type::Int64Ty && "only support f32/f64 for now!");
-      return ConstantInt::get(FP->getValueAPF().convertToAPInt());
+      return ConstantInt::get(FP->getValueAPF().bitcastToAPInt());
     }
   }
   return 0;