[llvm] [NFC][AArch64][SVE] Rename variables in partial reduction lowering functions (PR #120589)

Sander de Smalen via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 20 00:52:28 PST 2024


================
@@ -21739,73 +21739,71 @@ SDValue tryLowerPartialReductionToDot(SDNode *N,
   SDLoc DL(N);
 
   // The narrower of the two operands. Used as the accumulator
-  auto NarrowOp = N->getOperand(1);
-  auto MulOp = N->getOperand(2);
-  if (MulOp->getOpcode() != ISD::MUL)
+  auto A = N->getOperand(1);
+  auto B = N->getOperand(2);
+  if (B->getOpcode() != ISD::MUL)
     return SDValue();
 
-  auto ExtA = MulOp->getOperand(0);
-  auto ExtB = MulOp->getOperand(1);
+  auto ExtMulOp1 = B->getOperand(0);
+  auto ExtMulOp2 = B->getOperand(1);
 
-  if (!ISD::isExtOpcode(ExtA->getOpcode()) ||
-      !ISD::isExtOpcode(ExtB->getOpcode()))
+  if (!ISD::isExtOpcode(ExtMulOp1->getOpcode()) ||
+      !ISD::isExtOpcode(ExtMulOp2->getOpcode()))
     return SDValue();
-  bool AIsSigned = ExtA->getOpcode() == ISD::SIGN_EXTEND;
-  bool BIsSigned = ExtB->getOpcode() == ISD::SIGN_EXTEND;
+  bool MulOp1IsSigned = ExtMulOp1->getOpcode() == ISD::SIGN_EXTEND;
+  bool MulOp2IsSigned = ExtMulOp2->getOpcode() == ISD::SIGN_EXTEND;
 
-  auto A = ExtA->getOperand(0);
-  auto B = ExtB->getOperand(0);
-  if (A.getValueType() != B.getValueType())
+  auto MulOp1 = ExtMulOp1->getOperand(0);
+  auto MulOp2 = ExtMulOp2->getOperand(0);
----------------
sdesmalen-arm wrote:

Now that we know this is a recognised 'dot' operation we can define the operands and sub-operands with their appropriate names:
```
  SDValue Acc = N->getOperand(1);
  SDValue Mul = N->getOperand(2);
  SDValue ExtMulOpLHS = Mul->getOperand(0);
  SDValue ExtMulOpRHS = Mul->getOperand(1);
```

I realise this is defining N->getOperand(2) as both `Mul` and `Op2`, but in your later patch `Mul` will have to be generated (by multiplying `Op2` with `splat(1)`).

nit: For a binary operation like 'mul', it's common to use `LHS` and `RHS` for the operands.
nit: Only use `auto` when it's clear from the context what the type is. In this case, `SDValue Acc` is more appropriate than `auto Acc`.

https://github.com/llvm/llvm-project/pull/120589


More information about the llvm-commits mailing list