[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp

Chris Lattner sabre at nondot.org
Mon Feb 5 18:23:12 PST 2007



Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.134 -> 1.135
---
Log message:

Fix Transforms/ConstProp/2007-02-05-BitCast.ll


---
Diffs of the changes:  (+5 -1)

 ConstantFolding.cpp |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletion(-)


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.134 llvm/lib/VMCore/ConstantFolding.cpp:1.135
--- llvm/lib/VMCore/ConstantFolding.cpp:1.134	Tue Jan 30 22:40:28 2007
+++ llvm/lib/VMCore/ConstantFolding.cpp	Mon Feb  5 20:22:56 2007
@@ -296,8 +296,12 @@
     // 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:






More information about the llvm-commits mailing list