forked from OSchip/llvm-project
[DAG] FoldConstantArithmetic - rename NumOps -> NumElts. NFC.
NumOps represents the number of elements for vector constant folding, rename this NumElts so in future we can the consistently use NumOps to represent the number of operands of the opcode. Minor cleanup before trying to begin generalizing FoldConstantArithmetic to support opcodes other than binops.
This commit is contained in:
parent
a160aba95f
commit
f2703c3c33
|
@ -5256,7 +5256,7 @@ SDValue SelectionDAG::FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL,
|
|||
if (Opcode >= ISD::BUILTIN_OP_END || Opcode == ISD::CONCAT_VECTORS)
|
||||
return SDValue();
|
||||
|
||||
// For now, the array Ops should only contain two values.
|
||||
// TODO: For now, the array Ops should only contain two values.
|
||||
// This enforcement will be removed once this function is merged with
|
||||
// FoldConstantVectorArithmetic
|
||||
if (Ops.size() != 2)
|
||||
|
@ -5329,18 +5329,18 @@ SDValue SelectionDAG::FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL,
|
|||
}
|
||||
|
||||
SmallVector<SDValue, 4> Outputs;
|
||||
unsigned NumOps = 0;
|
||||
unsigned NumElts = 0;
|
||||
if (IsBVOrSV1)
|
||||
NumOps = std::max(NumOps, N1->getNumOperands());
|
||||
NumElts = std::max(NumElts, N1->getNumOperands());
|
||||
if (IsBVOrSV2)
|
||||
NumOps = std::max(NumOps, N2->getNumOperands());
|
||||
assert(NumOps != 0 && "Expected non-zero operands");
|
||||
NumElts = std::max(NumElts, N2->getNumOperands());
|
||||
assert(NumElts != 0 && "Expected non-zero operands");
|
||||
// Scalable vectors should only be SPLAT_VECTOR or UNDEF here. We only need
|
||||
// one iteration for that.
|
||||
assert((!VT.isScalableVector() || NumOps == 1) &&
|
||||
assert((!VT.isScalableVector() || NumElts == 1) &&
|
||||
"Scalable vector should only have one scalar");
|
||||
|
||||
for (unsigned I = 0; I != NumOps; ++I) {
|
||||
for (unsigned I = 0; I != NumElts; ++I) {
|
||||
// We can have a fixed length SPLAT_VECTOR and a BUILD_VECTOR so we need
|
||||
// to use operand 0 of the SPLAT_VECTOR for each fixed element.
|
||||
SDValue V1;
|
||||
|
|
Loading…
Reference in New Issue