aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Transforms/ExprTypeConvert.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index 1ce6eedbee..814318a587 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -210,7 +210,9 @@ Value *llvm::ConvertExpressionToType(Value *V, const Type *Ty,
Constant *CPV = cast<Constant>(V);
// Constants are converted by constant folding the cast that is required.
// We assume here that all casts are implemented for constant prop.
- Value *Result = ConstantExpr::getCast(CPV, Ty);
+ Instruction::CastOps opcode = CastInst::getCastOpcode(CPV,
+ CPV->getType()->isSigned(), Ty, Ty->isSigned());
+ Value *Result = ConstantExpr::getCast(opcode, CPV, Ty);
// Add the instruction to the expression map
//VMC.ExprMap[V] = Result;
return Result;