[SLP] rename variable to improve readability; NFC
authorSanjay Patel <spatel@rotateright.com>
Tue, 12 Jan 2021 19:55:09 +0000 (14:55 -0500)
committerSanjay Patel <spatel@rotateright.com>
Tue, 12 Jan 2021 21:03:57 +0000 (16:03 -0500)
The OperationData in the 2nd block (visiting the operands)
is completely independent of the 1st block.

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

index 04bdc74..1ef762c 100644 (file)
@@ -6826,7 +6826,7 @@ public:
     while (!Stack.empty()) {
       Instruction *TreeN = Stack.back().first;
       unsigned EdgeToVisit = Stack.back().second++;
-      OperationData OpData = getOperationData(TreeN);
+      const OperationData OpData = getOperationData(TreeN);
       bool IsReducedValue = OpData != RdxTreeInst;
 
       // Postorder vist.
@@ -6858,14 +6858,14 @@ public:
       // Visit left or right.
       Value *NextV = TreeN->getOperand(EdgeToVisit);
       auto *I = dyn_cast<Instruction>(NextV);
-      OpData = getOperationData(I);
+      const OperationData EdgeOpData = getOperationData(I);
       // Continue analysis if the next operand is a reduction operation or
       // (possibly) a reduced value. If the reduced value opcode is not set,
       // the first met operation != reduction operation is considered as the
       // reduced value class.
-      const bool IsRdxInst = OpData == RdxTreeInst;
+      const bool IsRdxInst = EdgeOpData == RdxTreeInst;
       if (I && I != Phi &&
-          (!RdxLeafVal || OpData == RdxLeafVal || IsRdxInst)) {
+          (!RdxLeafVal || EdgeOpData == RdxLeafVal || IsRdxInst)) {
         // Only handle trees in the current basic block.
         // Each tree node needs to have minimal number of users except for the
         // ultimate reduction.
@@ -6873,21 +6873,21 @@ public:
             RdxTreeInst.hasRequiredNumberOfUses(I, IsRdxInst) && I != B) {
           if (IsRdxInst) {
             // We need to be able to reassociate the reduction operations.
-            if (!OpData.isAssociative(I)) {
+            if (!EdgeOpData.isAssociative(I)) {
               // I is an extra argument for TreeN (its parent operation).
               markExtraArg(Stack.back(), I);
               continue;
             }
-          } else if (RdxLeafVal && RdxLeafVal != OpData) {
+          } else if (RdxLeafVal && RdxLeafVal != EdgeOpData) {
             // Make sure that the opcodes of the operations that we are going to
             // reduce match.
             // I is an extra argument for TreeN (its parent operation).
             markExtraArg(Stack.back(), I);
             continue;
           } else if (!RdxLeafVal) {
-            RdxLeafVal = OpData;
+            RdxLeafVal = EdgeOpData;
           }
-          Stack.push_back(std::make_pair(I, OpData.getFirstOperandIndex()));
+          Stack.push_back(std::make_pair(I, EdgeOpData.getFirstOperandIndex()));
           continue;
         }
       }