[llvm-commits] CVS: llvm/lib/VMCore/ConstantFolding.cpp
Reid Spencer
reid at x10sys.com
Mon Dec 11 13:27:43 PST 2006
Changes in directory llvm/lib/VMCore:
ConstantFolding.cpp updated: 1.112 -> 1.113
---
Log message:
Fix constant folding of FP->int due to cut & paste error in last commit.
---
Diffs of the changes: (+3 -2)
ConstantFolding.cpp | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.112 llvm/lib/VMCore/ConstantFolding.cpp:1.113
--- llvm/lib/VMCore/ConstantFolding.cpp:1.112 Mon Dec 11 12:30:27 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp Mon Dec 11 15:27:28 2006
@@ -983,9 +983,10 @@
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()));
}
}
More information about the llvm-commits
mailing list