aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-10-29 14:22:20 +0000
committerDuncan Sands <baldrick@free.fr>2008-10-29 14:22:20 +0000
commitd22ec5f62813f8cf2ed8091f44a14377209b1a59 (patch)
treee44982efd9dd16a78c8200883d8e35e6b6164e68 /lib/CodeGen
parent54898938673d2a13ce31626ec34b2d4d314b2c81 (diff)
downloadexternal_llvm-d22ec5f62813f8cf2ed8091f44a14377209b1a59.zip
external_llvm-d22ec5f62813f8cf2ed8091f44a14377209b1a59.tar.gz
external_llvm-d22ec5f62813f8cf2ed8091f44a14377209b1a59.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58378 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp22
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp9
2 files changed, 24 insertions, 7 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 3d809b4..0c73726 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/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;
}
}
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
index d04daeb..e34e78f 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp
@@ -390,14 +390,17 @@ static SDValue getCopyFromParts(SelectionDAG &DAG,
ValueVT : MVT::getIntegerVT(RoundBits);
SDValue Lo, Hi;
+ MVT HalfVT = ValueVT.isInteger() ?
+ MVT::getIntegerVT(RoundBits/2) :
+ MVT::getFloatingPointVT(RoundBits/2);
+
if (RoundParts > 2) {
- MVT HalfVT = MVT::getIntegerVT(RoundBits/2);
Lo = getCopyFromParts(DAG, Parts, RoundParts/2, PartVT, HalfVT);
Hi = getCopyFromParts(DAG, Parts+RoundParts/2, RoundParts/2,
PartVT, HalfVT);
} else {
- Lo = Parts[0];
- Hi = Parts[1];
+ Lo = DAG.getNode(ISD::BIT_CONVERT, HalfVT, Parts[0]);
+ Hi = DAG.getNode(ISD::BIT_CONVERT, HalfVT, Parts[1]);
}
if (TLI.isBigEndian())
std::swap(Lo, Hi);