From bbd49a0266921ce68a8581b8ae3d5c88eda8c679 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Mon, 21 Sep 2020 17:22:58 -0400 Subject: [PATCH] [SLP] move misplaced code comments; NFC --- llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp index da3342fa8eb7..0f9193e502a1 100644 --- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp +++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp @@ -6425,12 +6425,9 @@ class HorizontalReduction { if (!IsRedOp) return I->getParent() == P; if (isMinMax()) { - // SelectInst must be used twice while the condition op must have single - // use only. auto *Cmp = cast(cast(I)->getCondition()); return I->getParent() == P && Cmp && Cmp->getParent() == P; } - // Arithmetic reduction operation must be used once only. return I->getParent() == P; } @@ -6438,10 +6435,14 @@ class HorizontalReduction { bool hasRequiredNumberOfUses(Instruction *I, bool IsReductionOp) const { assert(Kind != RK_None && !!*this && LHS && RHS && "Expected reduction operation."); + // SelectInst must be used twice while the condition op must have single + // use only. if (isMinMax()) return I->hasNUses(2) && (!IsReductionOp || cast(I)->getCondition()->hasOneUse()); + + // Arithmetic reduction operation must be used once only. return I->hasOneUse(); }