From: Simon Pilgrim Date: Thu, 27 Jul 2017 15:08:53 +0000 (+0000) Subject: [SelectionDAG] Tidyup mask creation. NFCI. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4dabbadd262dc2a43dbb6c07c1797ce26d51d009;p=llvm [SelectionDAG] Tidyup mask creation. NFCI. Assign all concat elements to UNDEF and then just replace the first element, instead of copying everything individually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309277 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp b/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp index d41054b15bb..395fa3936dc 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp @@ -3021,12 +3021,9 @@ SDValue DAGTypeLegalizer::convertMask(SDValue InMask, EVT MaskVT, } else if (CurrMaskNumEls < ToMaskVT.getVectorNumElements()) { unsigned NumSubVecs = (ToMaskVT.getVectorNumElements() / CurrMaskNumEls); EVT SubVT = Mask->getValueType(0); - SmallVector SubConcatOps(NumSubVecs); - SubConcatOps[0] = Mask; - for (unsigned i = 1; i < NumSubVecs; ++i) - SubConcatOps[i] = DAG.getUNDEF(SubVT); - Mask = - DAG.getNode(ISD::CONCAT_VECTORS, SDLoc(Mask), ToMaskVT, SubConcatOps); + SmallVector SubOps(NumSubVecs, DAG.getUNDEF(SubVT)); + SubOps[0] = Mask; + Mask = DAG.getNode(ISD::CONCAT_VECTORS, SDLoc(Mask), ToMaskVT, SubOps); } assert((Mask->getValueType(0) == ToMaskVT) &&