[llvm-commits] CVS: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
Chris Lattner
sabre at nondot.org
Sun Dec 10 17:17:15 PST 2006
Changes in directory llvm/lib/Transforms/Scalar:
ScalarReplAggregates.cpp updated: 1.54 -> 1.55
---
Log message:
trunc to integer, not to FP.
---
Diffs of the changes: (+11 -2)
ScalarReplAggregates.cpp | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
Index: llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp
diff -u llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.54 llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.55
--- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp:1.54 Sun Dec 10 18:35:08 2006
+++ llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp Sun Dec 10 19:17:00 2006
@@ -660,8 +660,17 @@
} else if (LI->getType()->isFloatingPoint()) {
// If needed, truncate the integer to the appropriate size.
if (NV->getType()->getPrimitiveSize() >
- LI->getType()->getPrimitiveSize())
- NV = new TruncInst(NV, LI->getType(), LI->getName(), LI);
+ LI->getType()->getPrimitiveSize()) {
+ switch (LI->getType()->getTypeID()) {
+ default: assert(0 && "Unknown FP type!");
+ case Type::FloatTyID:
+ NV = new TruncInst(NV, Type::UIntTy, LI->getName(), LI);
+ break;
+ case Type::DoubleTyID:
+ NV = new TruncInst(NV, Type::ULongTy, LI->getName(), LI);
+ break;
+ }
+ }
// Then do a bitcast.
NV = new BitCastInst(NV, LI->getType(), LI->getName(), LI);
More information about the llvm-commits
mailing list