aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r--lib/VMCore/Instructions.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 800eb9cd1d..790f6ac8a6 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -1022,7 +1022,7 @@ void BinaryOperator::init(BinaryOps iType)
#ifndef NDEBUG
switch (iType) {
case Add: case Sub:
- case Mul: case Div:
+ case Mul:
case Rem:
assert(getType() == LHS->getType() &&
"Arithmetic operation should return same type as operands!");
@@ -1030,6 +1030,22 @@ void BinaryOperator::init(BinaryOps iType)
isa<PackedType>(getType())) &&
"Tried to create an arithmetic operation on a non-arithmetic type!");
break;
+ case UDiv:
+ case SDiv:
+ assert(getType() == LHS->getType() &&
+ "Arithmetic operation should return same type as operands!");
+ assert((getType()->isInteger() || (isa<PackedType>(getType()) &&
+ cast<PackedType>(getType())->getElementType()->isInteger())) &&
+ "Incorrect operand type (not integer) for S/UDIV");
+ break;
+ case FDiv:
+ assert(getType() == LHS->getType() &&
+ "Arithmetic operation should return same type as operands!");
+ assert((getType()->isFloatingPoint() || (isa<PackedType>(getType()) &&
+ cast<PackedType>(getType())->getElementType()->isFloatingPoint()))
+ && "Incorrect operand type (not floating point) for FDIV");
+ break;
+
case And: case Or:
case Xor:
assert(getType() == LHS->getType() &&