diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2015-02-17 15:29:18 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2015-02-17 15:29:18 +0000 |
commit | 6cd780ff2143656df213359b7a6df9a5a9237e17 (patch) | |
tree | b3689d2b8496e1cc569d85b5c59b0ac1d68beace /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | |
parent | 2ba8778157390981ba1e4a3b683aee09aa9f009f (diff) | |
download | bcm5719-llvm-6cd780ff2143656df213359b7a6df9a5a9237e17.tar.gz bcm5719-llvm-6cd780ff2143656df213359b7a6df9a5a9237e17.zip |
Prefer SmallVector::append/insert over push_back loops.
Same functionality, but hoists the vector growth out of the loop.
llvm-svn: 229500
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index c4a1a1f64b7..92164e92543 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -6913,8 +6913,7 @@ ConstantFoldBITCASTofBUILD_VECTOR(SDNode *BV, EVT DstEltVT) { for (unsigned i = 0, e = BV->getNumOperands(); i != e; ++i) { if (BV->getOperand(i).getOpcode() == ISD::UNDEF) { - for (unsigned j = 0; j != NumOutputsPerInput; ++j) - Ops.push_back(DAG.getUNDEF(DstEltVT)); + Ops.append(NumOutputsPerInput, DAG.getUNDEF(DstEltVT)); continue; } @@ -11754,10 +11753,7 @@ SDValue DAGCombiner::visitVECTOR_SHUFFLE(SDNode *N) { // constants directly. const SDValue &Splatted = V->getOperand(SVN->getSplatIndex()); if (isa<ConstantSDNode>(Splatted) || isa<ConstantFPSDNode>(Splatted)) { - SmallVector<SDValue, 8> Ops; - for (unsigned i = 0; i != NumElts; ++i) { - Ops.push_back(Splatted); - } + SmallVector<SDValue, 8> Ops(NumElts, Splatted); SDValue NewBV = DAG.getNode(ISD::BUILD_VECTOR, SDLoc(N), V->getValueType(0), Ops); |