aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Constants.cpp')
-rw-r--r--lib/VMCore/Constants.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/VMCore/Constants.cpp b/lib/VMCore/Constants.cpp
index dc3d9935d6..f52504298e 100644
--- a/lib/VMCore/Constants.cpp
+++ b/lib/VMCore/Constants.cpp
@@ -1500,14 +1500,7 @@ static inline Constant *getFoldedCast(
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 @@ Constant *ConstantExpr::getCast(unsigned oc, Constant *C, const Type *Ty) {
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);