aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/ExprTypeConvert.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Transforms/ExprTypeConvert.cpp')
-rw-r--r--lib/Transforms/ExprTypeConvert.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/Transforms/ExprTypeConvert.cpp b/lib/Transforms/ExprTypeConvert.cpp
index 36fd86e614..22ea6f3935 100644
--- a/lib/Transforms/ExprTypeConvert.cpp
+++ b/lib/Transforms/ExprTypeConvert.cpp
@@ -177,6 +177,7 @@ bool ExpressionConvertableToType(Value *V, const Type *Ty,
case Instruction::Add:
case Instruction::Sub:
+ if (!Ty->isInteger() && !Ty->isFloatingPoint()) return false;
if (!ExpressionConvertableToType(I->getOperand(0), Ty, CTMap) ||
!ExpressionConvertableToType(I->getOperand(1), Ty, CTMap))
return false;
@@ -610,6 +611,8 @@ static bool OperandConvertableToType(User *U, Value *V, const Type *Ty,
}
// FALLTHROUGH
case Instruction::Sub: {
+ if (!Ty->isInteger() && !Ty->isFloatingPoint()) return false;
+
Value *OtherOp = I->getOperand((V == I->getOperand(0)) ? 1 : 0);
return ValueConvertableToType(I, Ty, CTMap) &&
ExpressionConvertableToType(OtherOp, Ty, CTMap);