[llvm] r348494 - DAGCombiner::visitINSERT_VECTOR_ELT - pull out repeated VT.getVectorNumElements(). NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 6 07:39:25 PST 2018
Author: rksimon
Date: Thu Dec 6 07:39:25 2018
New Revision: 348494
URL: http://llvm.org/viewvc/llvm-project?rev=348494&view=rev
Log:
DAGCombiner::visitINSERT_VECTOR_ELT - pull out repeated VT.getVectorNumElements(). NFCI.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=348494&r1=348493&r2=348494&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Thu Dec 6 07:39:25 2018
@@ -15360,6 +15360,7 @@ SDValue DAGCombiner::visitINSERT_VECTOR_
return InVec;
EVT VT = InVec.getValueType();
+ unsigned NumElts = VT.getVectorNumElements();
// Remove redundant insertions:
// (insert_vector_elt x (extract_vector_elt x idx) idx) -> x
@@ -15372,7 +15373,7 @@ SDValue DAGCombiner::visitINSERT_VECTOR_
// If this is variable insert to undef vector, it might be better to splat:
// inselt undef, InVal, EltNo --> build_vector < InVal, InVal, ... >
if (InVec.isUndef() && TLI.shouldSplatInsEltVarIndex(VT)) {
- SmallVector<SDValue, 8> Ops(VT.getVectorNumElements(), InVal);
+ SmallVector<SDValue, 8> Ops(NumElts, InVal);
return DAG.getBuildVector(VT, DL, Ops);
}
return SDValue();
@@ -15417,11 +15418,11 @@ SDValue DAGCombiner::visitINSERT_VECTOR_
Ops.append(InVec.getNode()->op_begin(),
InVec.getNode()->op_end());
} else if (InVec.isUndef()) {
- unsigned NElts = VT.getVectorNumElements();
- Ops.append(NElts, DAG.getUNDEF(InVal.getValueType()));
+ Ops.append(NumElts, DAG.getUNDEF(InVal.getValueType()));
} else {
return SDValue();
}
+ assert(Ops.size() == NumElts && "Unexpected vector size");
// Insert the element
if (Elt < Ops.size()) {
More information about the llvm-commits
mailing list