Improve assertion messages.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103882 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dale Johannesen 2010-05-15 18:38:02 +00:00
parent a9790d739a
commit 789955127e

View File

@ -2627,7 +2627,8 @@ SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, EVT VT,
} }
break; break;
case ISD::AND: case ISD::AND:
assert(VT.isInteger() && N1.getValueType() == N2.getValueType() && assert(VT.isInteger() && "This operator does not apply to FP types!");
assert(N1.getValueType() == N2.getValueType() &&
N1.getValueType() == VT && "Binary operator types must match!"); N1.getValueType() == VT && "Binary operator types must match!");
// (X & 0) -> 0. This commonly occurs when legalizing i64 values, so it's // (X & 0) -> 0. This commonly occurs when legalizing i64 values, so it's
// worth handling here. // worth handling here.
@ -2640,7 +2641,8 @@ SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, EVT VT,
case ISD::XOR: case ISD::XOR:
case ISD::ADD: case ISD::ADD:
case ISD::SUB: case ISD::SUB:
assert(VT.isInteger() && N1.getValueType() == N2.getValueType() && assert(VT.isInteger() && "This operator does not apply to FP types!");
assert(N1.getValueType() == N2.getValueType() &&
N1.getValueType() == VT && "Binary operator types must match!"); N1.getValueType() == VT && "Binary operator types must match!");
// (X ^|+- 0) -> X. This commonly occurs when legalizing i64 values, so // (X ^|+- 0) -> X. This commonly occurs when legalizing i64 values, so
// it's worth handling here. // it's worth handling here.
@ -2655,7 +2657,9 @@ SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, EVT VT,
case ISD::SDIV: case ISD::SDIV:
case ISD::SREM: case ISD::SREM:
assert(VT.isInteger() && "This operator does not apply to FP types!"); assert(VT.isInteger() && "This operator does not apply to FP types!");
// fall through assert(N1.getValueType() == N2.getValueType() &&
N1.getValueType() == VT && "Binary operator types must match!");
break;
case ISD::FADD: case ISD::FADD:
case ISD::FSUB: case ISD::FSUB:
case ISD::FMUL: case ISD::FMUL:
@ -2678,6 +2682,7 @@ SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, EVT VT,
return N1; return N1;
} }
} }
assert(VT.isFloatingPoint() && "This operator only applies to FP types!");
assert(N1.getValueType() == N2.getValueType() && assert(N1.getValueType() == N2.getValueType() &&
N1.getValueType() == VT && "Binary operator types must match!"); N1.getValueType() == VT && "Binary operator types must match!");
break; break;