From: Sanjay Patel Date: Fri, 9 Jul 2021 16:48:42 +0000 (-0400) Subject: [SLP] improve code comments; NFC X-Git-Tag: llvmorg-14-init~1936 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=486992f958cedc0b0ce4ab29262deb48cc8c8a51;p=platform%2Fupstream%2Fllvm.git [SLP] improve code comments; NFC This likely started out only supporint binops, but now we handle min/max using cmp+sel, and we may extend to handle bool logic in the form of select. --- diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index 7c49a95..246f755 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -7517,7 +7517,7 @@ class HorizontalReduction { } /// Checks if the instruction is in basic block \p BB. - /// For a min/max reduction check that both compare and select are in \p BB. + /// For a cmp+sel min/max reduction check that both ops are in \p BB. static bool hasSameParent(Instruction *I, BasicBlock *BB) { if (isCmpSelMinMax(I)) { auto *Sel = cast(I); @@ -7624,8 +7624,8 @@ public: // potential candidate for the reduction. unsigned LeafOpcode = 0; - // Post order traverse the reduction tree starting at B. We only handle true - // trees containing only binary operators. + // Post-order traverse the reduction tree starting at Inst. We only handle + // true trees containing binary operators or selects. SmallVector, 32> Stack; Stack.push_back(std::make_pair(Inst, getFirstOperandIndex(Inst))); initReductionOps(Inst); @@ -7661,7 +7661,7 @@ public: continue; } - // Visit left or right. + // Visit operands. Value *EdgeVal = TreeN->getOperand(EdgeToVisit); auto *EdgeInst = dyn_cast(EdgeVal); if (!EdgeInst) {