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

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



Changes in directory llvm/lib/VMCore:

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

Remove the last use of getUnsignedVersion and getSignedVersion from VMCore.
ConstantInt doesn't care about the sign of the type it represents. It only
cares about the bitwidth so there is no need to make the sign of the type
match the SExt or ZExt constant expression.


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

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


Index: llvm/lib/VMCore/ConstantFolding.cpp
diff -u llvm/lib/VMCore/ConstantFolding.cpp:1.114 llvm/lib/VMCore/ConstantFolding.cpp:1.115
--- llvm/lib/VMCore/ConstantFolding.cpp:1.114	Tue Dec 12 17:36:14 2006
+++ llvm/lib/VMCore/ConstantFolding.cpp	Sun Dec 17 19:11:03 2006
@@ -875,16 +875,14 @@
     // 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->getUnsignedVersion(), 
-                           cast<ConstantIntegral>(V)->getZExtValue());
+      V = ConstantInt::get(SrcTy, 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->getSignedVersion(), 
-                           cast<ConstantIntegral>(V)->getSExtValue());
+      V = ConstantInt::get(SrcTy, 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