[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Dan Gohman
djg at cray.com
Thu Jun 28 17:09:30 PDT 2007
Changes in directory llvm/lib/CodeGen/SelectionDAG:
LegalizeDAG.cpp updated: 1.503 -> 1.504
---
Log message:
Fix an assertion failure in legalizing bitcast operators on targets where
vectors are split down to single elements as part of legalization.
---
Diffs of the changes: (+15 -23)
LegalizeDAG.cpp | 38 +++++++++++++++-----------------------
1 files changed, 15 insertions(+), 23 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.503 llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.504
--- llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1.503 Wed Jun 27 11:08:04 2007
+++ llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Thu Jun 28 19:09:08 2007
@@ -5568,38 +5568,30 @@
case ISD::BIT_CONVERT: {
// We know the result is a vector. The input may be either a vector or a
// scalar value.
- if (!MVT::isVector(Op.getOperand(0).getValueType())) {
- // Lower to a store/load. FIXME: this could be improved probably.
- SDOperand Ptr = CreateStackTemporary(Op.getOperand(0).getValueType());
+ SDOperand InOp = Node->getOperand(0);
+ if (!MVT::isVector(InOp.getValueType()) ||
+ MVT::getVectorNumElements(InOp.getValueType()) == 1) {
+ // The input is a scalar or single-element vector.
+ // Lower to a store/load so that it can be split.
+ // FIXME: this could be improved probably.
+ SDOperand Ptr = CreateStackTemporary(InOp.getValueType());
SDOperand St = DAG.getStore(DAG.getEntryNode(),
- Op.getOperand(0), Ptr, NULL, 0);
- St = DAG.getLoad(NewVT, St, Ptr, NULL, 0);
- SplitVectorOp(St, Lo, Hi);
- } else {
- // If the input is a vector type, we have to either scalarize it, pack it
- // or convert it based on whether the input vector type is legal.
- SDNode *InVal = Node->getOperand(0).Val;
- unsigned NumElems = MVT::getVectorNumElements(InVal->getValueType(0));
-
- assert(NumElems > 1);
- {
- // Split the input vector.
- SplitVectorOp(Op.getOperand(0), Lo, Hi);
-
- // Convert each of the pieces now.
- Lo = DAG.getNode(ISD::BIT_CONVERT, NewVT, Lo);
- Hi = DAG.getNode(ISD::BIT_CONVERT, NewVT, Hi);
- }
- break;
+ InOp, Ptr, NULL, 0);
+ InOp = DAG.getLoad(Op.getValueType(), St, Ptr, NULL, 0);
}
+ // Split the vector and convert each of the pieces now.
+ SplitVectorOp(InOp, Lo, Hi);
+ Lo = DAG.getNode(ISD::BIT_CONVERT, NewVT, Lo);
+ Hi = DAG.getNode(ISD::BIT_CONVERT, NewVT, Hi);
+ break;
}
}
// Remember in a map if the values will be reused later.
bool isNew =
SplitNodes.insert(std::make_pair(Op, std::make_pair(Lo, Hi))).second;
- assert(isNew && "Value already expanded?!?");
+ assert(isNew && "Value already split?!?");
}
More information about the llvm-commits
mailing list