@@ -4908,7 +4908,9 @@ void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) {
4908
4908
static MVT getPromotedVectorElementType (const TargetLowering &TLI,
4909
4909
MVT EltVT, MVT NewEltVT) {
4910
4910
unsigned OldEltsPerNewElt = EltVT.getSizeInBits () / NewEltVT.getSizeInBits ();
4911
- MVT MidVT = MVT::getVectorVT (NewEltVT, OldEltsPerNewElt);
4911
+ MVT MidVT = OldEltsPerNewElt == 1
4912
+ ? NewEltVT
4913
+ : MVT::getVectorVT (NewEltVT, OldEltsPerNewElt);
4912
4914
assert (TLI.isTypeLegal (MidVT) && " unexpected" );
4913
4915
return MidVT;
4914
4916
}
@@ -5395,7 +5397,7 @@ void SelectionDAGLegalize::PromoteNode(SDNode *Node) {
5395
5397
5396
5398
assert (NVT.isVector () && OVT.getSizeInBits () == NVT.getSizeInBits () &&
5397
5399
" Invalid promote type for build_vector" );
5398
- assert (NewEltVT.bitsLT (EltVT) && " not handled" );
5400
+ assert (NewEltVT.bitsLE (EltVT) && " not handled" );
5399
5401
5400
5402
MVT MidVT = getPromotedVectorElementType (TLI, EltVT, NewEltVT);
5401
5403
@@ -5406,7 +5408,9 @@ void SelectionDAGLegalize::PromoteNode(SDNode *Node) {
5406
5408
}
5407
5409
5408
5410
SDLoc SL (Node);
5409
- SDValue Concat = DAG.getNode (ISD::CONCAT_VECTORS, SL, NVT, NewOps);
5411
+ SDValue Concat =
5412
+ DAG.getNode (MidVT == NewEltVT ? ISD::BUILD_VECTOR : ISD::CONCAT_VECTORS,
5413
+ SL, NVT, NewOps);
5410
5414
SDValue CvtVec = DAG.getNode (ISD::BITCAST, SL, OVT, Concat);
5411
5415
Results.push_back (CvtVec);
5412
5416
break ;
0 commit comments