[DAG] FoldConstantArithmetic - rename NumOps -> NumElts. NFC.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 5 Nov 2021 13:18:53 +0000 (13:18 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 5 Nov 2021 13:32:34 +0000 (13:32 +0000)
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.

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 0525646..4a4d00e 100644 (file)
@@ -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;