[llvm] 486992f - [SLP] improve code comments; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 9 09:50:00 PDT 2021


Author: Sanjay Patel
Date: 2021-07-09T12:49:54-04:00
New Revision: 486992f958cedc0b0ce4ab29262deb48cc8c8a51

URL: https://github.com/llvm/llvm-project/commit/486992f958cedc0b0ce4ab29262deb48cc8c8a51
DIFF: https://github.com/llvm/llvm-project/commit/486992f958cedc0b0ce4ab29262deb48cc8c8a51.diff

LOG: [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.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 7c49a952c62e..246f755eac03 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<SelectInst>(I);
@@ -7624,8 +7624,8 @@ class HorizontalReduction {
     // 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<std::pair<Instruction *, unsigned>, 32> Stack;
     Stack.push_back(std::make_pair(Inst, getFirstOperandIndex(Inst)));
     initReductionOps(Inst);
@@ -7661,7 +7661,7 @@ class HorizontalReduction {
         continue;
       }
 
-      // Visit left or right.
+      // Visit operands.
       Value *EdgeVal = TreeN->getOperand(EdgeToVisit);
       auto *EdgeInst = dyn_cast<Instruction>(EdgeVal);
       if (!EdgeInst) {


        


More information about the llvm-commits mailing list