diff options
author | Duncan Sands <baldrick@free.fr> | 2008-10-29 14:22:20 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-10-29 14:22:20 +0000 |
commit | 17e678be87104a4b2fbc8910b695d20ae2385527 (patch) | |
tree | 94a471b6dc3fa29f6f8886d08a0f7bbce55d303b /llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | |
parent | 9774aa13c747c5fb6d933109a4a2a5d2d4924264 (diff) | |
download | bcm5719-llvm-17e678be87104a4b2fbc8910b695d20ae2385527.tar.gz bcm5719-llvm-17e678be87104a4b2fbc8910b695d20ae2385527.zip |
Add sanity checking for BUILD_PAIR (I noticed the
other day that PPC custom lowering could create
a BUILD_PAIR of two f64 with a result type of...
f64! - already fixed). Fix a place that triggers
the sanity check.
llvm-svn: 58378
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 3d809b4983d..0c737261aa6 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -758,11 +758,25 @@ void SelectionDAG::VerifyNode(SDNode *N) { switch (N->getOpcode()) { default: break; + case ISD::BUILD_PAIR: { + MVT VT = N->getValueType(0); + assert(N->getNumValues() == 1 && "Too many results!"); + assert(!VT.isVector() && (VT.isInteger() || VT.isFloatingPoint()) && + "Wrong return type!"); + assert(N->getNumOperands() == 2 && "Wrong number of operands!"); + assert(N->getOperand(0).getValueType() == N->getOperand(1).getValueType() && + "Mismatched operand types!"); + assert(N->getOperand(0).getValueType().isInteger() == VT.isInteger() && + "Wrong operand type!"); + assert(VT.getSizeInBits() == 2 * N->getOperand(0).getValueSizeInBits() && + "Wrong return type size"); + break; + } case ISD::BUILD_VECTOR: { - assert(N->getNumValues() == 1 && "Too many results for BUILD_VECTOR!"); - assert(N->getValueType(0).isVector() && "Wrong BUILD_VECTOR return type!"); + assert(N->getNumValues() == 1 && "Too many results!"); + assert(N->getValueType(0).isVector() && "Wrong return type!"); assert(N->getNumOperands() == N->getValueType(0).getVectorNumElements() && - "Wrong number of BUILD_VECTOR operands!"); + "Wrong number of operands!"); // FIXME: Change vector_shuffle to a variadic node with mask elements being // operands of the node. Currently the mask is a BUILD_VECTOR passed as an // operand, and it is not always possible to legalize it. Turning off the @@ -770,7 +784,7 @@ void SelectionDAG::VerifyNode(SDNode *N) { // MVT EltVT = N->getValueType(0).getVectorElementType(); // for (SDNode::op_iterator I = N->op_begin(), E = N->op_end(); I != E; ++I) // assert(I->getSDValue().getValueType() == EltVT && -// "Wrong BUILD_VECTOR operand type!"); +// "Wrong operand type!"); break; } } |