[PATCH] D132261: [SLP]Do not reduce repeated values, use scalar red ops instead.
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 15 08:02:16 PST 2023
ABataev added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12560
+ MapVector<Value *, unsigned> SameValuesCounter;
+ for (Value *V : Candidates)
+ ++SameValuesCounter.insert(std::make_pair(V, 0)).first->second;
----------------
vdmitrie wrote:
> We don't need to collect repeating counters if IsSupportedreusedRdxOp is false.
No, still need it, it is used to produce vector of unique scalars, see line 12577.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:12566
+ RdxKind != RecurKind::FMul && RdxKind != RecurKind::FMulAdd;
+ bool SameScaleFactor = false;
+ bool HasReusedScalars = SameValuesCounter.size() != Candidates.size();
----------------
vdmitrie wrote:
> This needs a comment. Are you trying to catch a case for special processing when each value used same times? Please describe what is the benefit of catching such cases?
> Why are you trying to calculate it this early?
It may help to produce better vector ops. Say, we have 8 x aabbccdd. It will require reduction of 8 elements + the built tree still will operate on 4 x element, but the last node will have reshuffle from 4 x vector to 8 x vector + red(8 x ). Instead we may have just red(4 x abcd)*2.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132261/new/
https://reviews.llvm.org/D132261
More information about the llvm-commits
mailing list