[SLP] rename variable to improve readability; NFC

The OperationData in the 2nd block (visiting the operands)
is completely independent of the 1st block.
This commit is contained in:
Sanjay Patel 2021-01-12 14:55:09 -05:00
parent 554be30a42
commit 92fb5c49e8
1 changed files with 8 additions and 8 deletions

View File

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