[PATCH] D67841: [SLP] avoid reduction transform on patterns that the backend can load-combine
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 11 09:47:16 PDT 2019
ABataev added inline comments.
================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:1698
+ /// may not be necessary.
+ llvm::Optional<int> getLoadCombineCost(Value *V) {
+ using namespace llvm::PatternMatch;
----------------
Shall we just terminate the reduction of this special construct unconditionally? Do we need this cost calculation just to prevent the reduction all the time we see this pattern? If yes, then, probably, we don't need to calculate the cost.
There is a function `isTreeTinyAndNotFullyVectorizable()`. Can you put pattern matching analysis for this particular construct in this function without any additional cost analysis?
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:6504-6505
case RK_Arithmetic:
- ScalarReduxCost =
- TTI->getArithmeticInstrCost(ReductionData.getOpcode(), ScalarTy);
+ if (ReductionData.getOpcode() == Instruction::Or)
+ LoadCombineCost = TTI->getLoadCombineCost(FirstReducedVal);
+ if (LoadCombineCost) {
----------------
Maybe better to put the check for the operation into the function itself?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67841/new/
https://reviews.llvm.org/D67841
More information about the llvm-commits
mailing list