summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-12-14 06:49:07 +0000
committerCraig Topper <craig.topper@intel.com>2017-12-14 06:49:07 +0000
commitcf77203ff68d19af3b64d985ecb9110a777a4ae5 (patch)
treea47c03354350b0beba9c6393ce1f1c64b039d3fa /llvm/lib/CodeGen
parentf01caab4b7ee9673d010c849b5a77c2489670db7 (diff)
downloadbcm5719-llvm-cf77203ff68d19af3b64d985ecb9110a777a4ae5.tar.gz
bcm5719-llvm-cf77203ff68d19af3b64d985ecb9110a777a4ae5.zip
[SelectionDAG] When legalizing the result type of CONCAT_VECTORS, take into account whether the input type also needs to be promoted.
If so go ahead and get the promoted input vector to extract from. Previously, we would create a bunch of any_extends of extract_vector_elts with illegal input type that needs to be promoted. The legalization of those extract_vector_elts would then potentially introduce a truncate. So now we have a bunch of any_extends of truncates. By legalizing both parts together we avoid creating these extra nodes. The test changes seem to be because we were previously combining the build_vector with the any_extend before the any_extend got combined with the truncate. llvm-svn: 320669
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
index ec8d6db66f7..8db0d043dd1 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
@@ -3489,7 +3489,6 @@ SDValue DAGTypeLegalizer::PromoteIntRes_CONCAT_VECTORS(SDNode *N) {
EVT NOutVT = TLI.getTypeToTransformTo(*DAG.getContext(), OutVT);
assert(NOutVT.isVector() && "This type must be promoted to a vector type");
- EVT InElemTy = OutVT.getVectorElementType();
EVT OutElemTy = NOutVT.getVectorElementType();
unsigned NumElem = N->getOperand(0).getValueType().getVectorNumElements();
@@ -3502,11 +3501,17 @@ SDValue DAGTypeLegalizer::PromoteIntRes_CONCAT_VECTORS(SDNode *N) {
SmallVector<SDValue, 8> Ops(NumOutElem);
for (unsigned i = 0; i < NumOperands; ++i) {
SDValue Op = N->getOperand(i);
+ if (getTypeAction(Op.getValueType()) == TargetLowering::TypePromoteInteger)
+ Op = GetPromotedInteger(Op);
+ EVT SclrTy = Op.getValueType().getVectorElementType();
+ assert(NumElem == Op.getValueType().getVectorNumElements() &&
+ "Unexpected number of elements");
+
for (unsigned j = 0; j < NumElem; ++j) {
SDValue Ext = DAG.getNode(
- ISD::EXTRACT_VECTOR_ELT, dl, InElemTy, Op,
+ ISD::EXTRACT_VECTOR_ELT, dl, SclrTy, Op,
DAG.getConstant(j, dl, TLI.getVectorIdxTy(DAG.getDataLayout())));
- Ops[i * NumElem + j] = DAG.getNode(ISD::ANY_EXTEND, dl, OutElemTy, Ext);
+ Ops[i * NumElem + j] = DAG.getAnyExtOrTrunc(Ext, dl, OutElemTy);
}
}
OpenPOWER on IntegriCloud