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

Reid Spencer reid at x10sys.com
Tue Dec 5 11:14:30 PST 2006



Changes in directory llvm/lib/VMCore:

Constants.cpp updated: 1.180 -> 1.181
---
Log message:

Bail on the getInferredCast idea. Remove the function and convert 
remaining uses to more specific casts.


---
Diffs of the changes:  (+8 -8)

 Constants.cpp |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)


Index: llvm/lib/VMCore/Constants.cpp
diff -u llvm/lib/VMCore/Constants.cpp:1.180 llvm/lib/VMCore/Constants.cpp:1.181
--- llvm/lib/VMCore/Constants.cpp:1.180	Mon Dec  4 21:25:26 2006
+++ llvm/lib/VMCore/Constants.cpp	Tue Dec  5 13:14:13 2006
@@ -1500,14 +1500,7 @@
   ExprMapKeyType Key(opc, argVec);
   return ExprConstants->getOrCreate(Ty, Key);
 }
-
-Constant *ConstantExpr::getInferredCast(Constant *C, bool SrcIsSigned, 
-                                const Type *Ty, bool DestIsSigned) {
-  // Note: we can't inline this because it requires the Instructions.h header
-  return getCast(
-    CastInst::getCastOpcode(C, SrcIsSigned, Ty, DestIsSigned), C, Ty);
-}
-
+ 
 Constant *ConstantExpr::getCast(unsigned oc, Constant *C, const Type *Ty) {
   Instruction::CastOps opc = Instruction::CastOps(oc);
   assert(Instruction::isCast(opc) && "opcode out of range");
@@ -1532,8 +1525,15 @@
     case Instruction::BitCast:  return getBitCast(C, Ty);
   }
   return 0;
+} 
+
+Constant *ConstantExpr::getCast(Constant *C, const Type *Ty) {
+  // Note: we can't inline this because it requires the Instructions.h header
+  return getCast(CastInst::getCastOpcode(
+        C, C->getType()->isSigned(), Ty, Ty->isSigned()), C, Ty);
 }
 
+
 Constant *ConstantExpr::getZExtOrBitCast(Constant *C, const Type *Ty) {
   if (C->getType()->getPrimitiveSizeInBits() == Ty->getPrimitiveSizeInBits())
     return getCast(Instruction::BitCast, C, Ty);






More information about the llvm-commits mailing list