Skip to content

Commit f2703c3

Browse files
committed
[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.
1 parent a160aba commit f2703c3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5256,7 +5256,7 @@ SDValue SelectionDAG::FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL,
52565256
if (Opcode >= ISD::BUILTIN_OP_END || Opcode == ISD::CONCAT_VECTORS)
52575257
return SDValue();
52585258

5259-
// For now, the array Ops should only contain two values.
5259+
// TODO: For now, the array Ops should only contain two values.
52605260
// This enforcement will be removed once this function is merged with
52615261
// FoldConstantVectorArithmetic
52625262
if (Ops.size() != 2)
@@ -5329,18 +5329,18 @@ SDValue SelectionDAG::FoldConstantArithmetic(unsigned Opcode, const SDLoc &DL,
53295329
}
53305330

53315331
SmallVector<SDValue, 4> Outputs;
5332-
unsigned NumOps = 0;
5332+
unsigned NumElts = 0;
53335333
if (IsBVOrSV1)
5334-
NumOps = std::max(NumOps, N1->getNumOperands());
5334+
NumElts = std::max(NumElts, N1->getNumOperands());
53355335
if (IsBVOrSV2)
5336-
NumOps = std::max(NumOps, N2->getNumOperands());
5337-
assert(NumOps != 0 && "Expected non-zero operands");
5336+
NumElts = std::max(NumElts, N2->getNumOperands());
5337+
assert(NumElts != 0 && "Expected non-zero operands");
53385338
// Scalable vectors should only be SPLAT_VECTOR or UNDEF here. We only need
53395339
// one iteration for that.
5340-
assert((!VT.isScalableVector() || NumOps == 1) &&
5340+
assert((!VT.isScalableVector() || NumElts == 1) &&
53415341
"Scalable vector should only have one scalar");
53425342

5343-
for (unsigned I = 0; I != NumOps; ++I) {
5343+
for (unsigned I = 0; I != NumElts; ++I) {
53445344
// We can have a fixed length SPLAT_VECTOR and a BUILD_VECTOR so we need
53455345
// to use operand 0 of the SPLAT_VECTOR for each fixed element.
53465346
SDValue V1;

0 commit comments

Comments
 (0)