[llvm] 21f97fd - [DAG] Use getSplatBuildVector in a couple more places [nfc]

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 3 09:49:02 PDT 2022


Author: Philip Reames
Date: 2022-10-03T09:48:49-07:00
New Revision: 21f97fdc9788fdc294659055f16290688c11e540

URL: https://github.com/llvm/llvm-project/commit/21f97fdc9788fdc294659055f16290688c11e540
DIFF: https://github.com/llvm/llvm-project/commit/21f97fdc9788fdc294659055f16290688c11e540.diff

LOG: [DAG] Use getSplatBuildVector in a couple more places [nfc]

Added: 
    

Modified: 
    llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 86823ddab19e..a6c9c4620156 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -19781,9 +19781,7 @@ SDValue DAGCombiner::visitINSERT_VECTOR_ELT(SDNode *N) {
     if (InVec.isUndef() && TLI.shouldSplatInsEltVarIndex(VT)) {
       if (VT.isScalableVector())
         return DAG.getSplatVector(VT, DL, InVal);
-
-      SmallVector<SDValue, 8> Ops(VT.getVectorNumElements(), InVal);
-      return DAG.getBuildVector(VT, DL, Ops);
+      return DAG.getSplatBuildVector(VT, DL, InVal);
     }
     return SDValue();
   }
@@ -23821,8 +23819,7 @@ static SDValue scalarizeBinOpOfSplats(SDNode *N, SelectionDAG &DAG,
   // bo (splat X, Index), (splat Y, Index) --> splat (bo X, Y), Index
   if (VT.isScalableVector())
     return DAG.getSplatVector(VT, DL, ScalarBO);
-  SmallVector<SDValue, 8> Ops(VT.getVectorNumElements(), ScalarBO);
-  return DAG.getBuildVector(VT, DL, Ops);
+  return DAG.getSplatBuildVector(VT, DL, ScalarBO);
 }
 
 /// Visit a binary vector operation, like ADD.

diff  --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index aa07f4728642..60e63035a898 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1697,10 +1697,7 @@ SDValue SelectionDAGBuilder::getValueImpl(const Value *V) {
 
       if (isa<ScalableVectorType>(VecTy))
         return NodeMap[V] = DAG.getSplatVector(VT, getCurSDLoc(), Op);
-
-      SmallVector<SDValue, 16> Ops;
-      Ops.assign(cast<FixedVectorType>(VecTy)->getNumElements(), Op);
-      return NodeMap[V] = DAG.getBuildVector(VT, getCurSDLoc(), Ops);
+      return NodeMap[V] = DAG.getSplatBuildVector(VT, getCurSDLoc(), Op);
     }
 
     llvm_unreachable("Unknown vector constant");


        


More information about the llvm-commits mailing list