]> granicus.if.org Git - llvm/commitdiff
[SelectionDAG] In SplitVecOp_EXTRACT_VECTOR_ELT, simplify the code that makes the...
authorCraig Topper <craig.topper@intel.com>
Thu, 7 Dec 2017 08:04:34 +0000 (08:04 +0000)
committerCraig Topper <craig.topper@intel.com>
Thu, 7 Dec 2017 08:04:34 +0000 (08:04 +0000)
We can just extend the original vector to vXi1 and trust that the legalization process will revisit it.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320013 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp

index b574c1ea8b5d67455e7a50b059b4bf2727377688..2ee83a193f3cfb460305fe2c839d9db72a0660bc 100644 (file)
@@ -1749,20 +1749,11 @@ SDValue DAGTypeLegalizer::SplitVecOp_EXTRACT_VECTOR_ELT(SDNode *N) {
   // Make the vector elements byte-addressable if they aren't already.
   SDLoc dl(N);
   EVT EltVT = VecVT.getVectorElementType();
-  if (EltVT.getSizeInBits() < 8) {
-    SmallVector<SDValue, 4> ElementOps;
-    for (unsigned i = 0; i < VecVT.getVectorNumElements(); ++i) {
-      ElementOps.push_back(DAG.getAnyExtOrTrunc(
-          DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, EltVT, Vec,
-                      DAG.getConstant(i, dl,
-                                      TLI.getVectorIdxTy(DAG.getDataLayout()))),
-          dl, MVT::i8));
-    }
-
+  if (VecVT.getScalarSizeInBits() < 8) {
     EltVT = MVT::i8;
     VecVT = EVT::getVectorVT(*DAG.getContext(), EltVT,
                              VecVT.getVectorNumElements());
-    Vec = DAG.getBuildVector(VecVT, dl, ElementOps);
+    Vec = DAG.getNode(ISD::ANY_EXTEND, dl, VecVT, Vec);
   }
 
   // Store the vector to the stack.