1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[DAG] BuildVectorSDNode::getSplatValue - pull out repeated getNumOperands() calls. NFCI.

This commit is contained in:
Simon Pilgrim 2020-09-18 15:11:13 +01:00
parent 655fbd5c46
commit 99d78e28b2

View File

@ -9766,16 +9766,16 @@ bool BuildVectorSDNode::isConstantSplat(APInt &SplatValue, APInt &SplatUndef,
SDValue BuildVectorSDNode::getSplatValue(const APInt &DemandedElts, SDValue BuildVectorSDNode::getSplatValue(const APInt &DemandedElts,
BitVector *UndefElements) const { BitVector *UndefElements) const {
unsigned NumOps = getNumOperands();
if (UndefElements) { if (UndefElements) {
UndefElements->clear(); UndefElements->clear();
UndefElements->resize(getNumOperands()); UndefElements->resize(NumOps);
} }
assert(getNumOperands() == DemandedElts.getBitWidth() && assert(NumOps == DemandedElts.getBitWidth() && "Unexpected vector size");
"Unexpected vector size");
if (!DemandedElts) if (!DemandedElts)
return SDValue(); return SDValue();
SDValue Splatted; SDValue Splatted;
for (unsigned i = 0, e = getNumOperands(); i != e; ++i) { for (unsigned i = 0; i != NumOps; ++i) {
if (!DemandedElts[i]) if (!DemandedElts[i])
continue; continue;
SDValue Op = getOperand(i); SDValue Op = getOperand(i);