[llvm] c2b7f09 - [SLP] make invalid operand explicit for extra arg in reduction matching; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 9 12:32:20 PDT 2021
Author: Sanjay Patel
Date: 2021-07-09T15:32:12-04:00
New Revision: c2b7f09d8c276c83f3af5123a0ca55d62b0ffaab
URL: https://github.com/llvm/llvm-project/commit/c2b7f09d8c276c83f3af5123a0ca55d62b0ffaab
DIFF: https://github.com/llvm/llvm-project/commit/c2b7f09d8c276c83f3af5123a0ca55d62b0ffaab.diff
LOG: [SLP] make invalid operand explicit for extra arg in reduction matching; NFC
This makes it clearer when we have encountered the extra arg.
Also, we may need to adjust the way the operand iteration
works when handling logical and/or.
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 246f755eac03..04ee349396cd 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -7288,6 +7288,8 @@ class HorizontalReduction {
/// The type of reduction operation.
RecurKind RdxKind;
+ const unsigned INVALID_OPERAND_INDEX = std::numeric_limits<unsigned>::max();
+
static bool isCmpSelMinMax(Instruction *I) {
return match(I, m_Select(m_Cmp(), m_Value(), m_Value())) &&
RecurrenceDescriptor::isMinMaxRecurrenceKind(getRdxKind(I));
@@ -7322,7 +7324,7 @@ class HorizontalReduction {
// in this case.
// Do not perform analysis of remaining operands of ParentStackElem.first
// instruction, this whole instruction is an extra argument.
- ParentStackElem.second = getNumberOfOperands(ParentStackElem.first);
+ ParentStackElem.second = INVALID_OPERAND_INDEX;
} else {
// We ran into something like:
// ParentStackElem.first += ... + ExtraArg + ...
@@ -7636,7 +7638,7 @@ class HorizontalReduction {
bool IsReducedValue = TreeRdxKind != RdxKind;
// Postorder visit.
- if (IsReducedValue || EdgeToVisit == getNumberOfOperands(TreeN)) {
+ if (IsReducedValue || EdgeToVisit >= getNumberOfOperands(TreeN)) {
if (IsReducedValue)
ReducedVals.push_back(TreeN);
else {
More information about the llvm-commits
mailing list