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

Reid Spencer reid at x10sys.com
Sun Dec 17 20:23:11 PST 2006



Changes in directory llvm/lib/VMCore:

ConstantFolding.cpp updated: 1.115 -> 1.116
---
Log message:

Revert last patch. ConstantInt isn't quite ready for signlessness.


---
Diffs of the changes:  (+4 -2)

 ConstantFolding.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.115 llvm/lib/VMCore/ConstantFolding.cpp:1.116
--- llvm/lib/VMCore/ConstantFolding.cpp:1.115	Sun Dec 17 19:11:03 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp	Sun Dec 17 22:22:56 2006
@@ -875,14 +875,16 @@
     // A ZExt always produces an unsigned value so we need to cast the value
     // now before we try to cast it to the destination type
     if (isa<ConstantInt>(V))
-      V = ConstantInt::get(SrcTy, cast<ConstantIntegral>(V)->getZExtValue());
+      V = ConstantInt::get(SrcTy->getUnsignedVersion(), 
+                           cast<ConstantIntegral>(V)->getZExtValue());
     break;
   case Instruction::SIToFP:
   case Instruction::SExt:
     // A SExt always produces a signed value so we need to cast the value
     // now before we try to cast it to the destiniation type.
     if (isa<ConstantInt>(V))
-      V = ConstantInt::get(SrcTy, cast<ConstantIntegral>(V)->getSExtValue());
+      V = ConstantInt::get(SrcTy->getSignedVersion(), 
+                           cast<ConstantIntegral>(V)->getSExtValue());
     else if (const ConstantBool *CB = dyn_cast<ConstantBool>(V))
       V = ConstantInt::get(Type::SByteTy, CB->getValue() ? -1 : 0);
       






More information about the llvm-commits mailing list