[PATCH] D149627: [NFC][SLP] Cleanup: Simplify traversal loop in SLPVectorizerPass::vectorizeHorReduction().
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue May 2 10:37:18 PDT 2023
ABataev added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:14008
+ assert(Op0 && Op1 && "Expected Binop");
+ Instruction *Op = dyn_cast<Instruction>(Op0);
+ if (Op == Phi)
----------------
`auto *Op`
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:14008-14010
+ Instruction *Op = dyn_cast<Instruction>(Op0);
+ if (Op == Phi)
+ Op = dyn_cast<Instruction>(Op1);
----------------
ABataev wrote:
> `auto *Op`
`return dyn_cast<Instruction>(Op0 == Phi ? Op1 : Op0);`
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:14064-14070
+ Value *VectorizedV = nullptr;
+ if (!R.isAnalyzedReductionRoot(Inst) && isReductionCandidate(Inst)) {
+ HorizontalReduction HorRdx;
+ if (HorRdx.matchAssociativeReduction(Inst, *SE, *DL, *TLI))
+ VectorizedV = HorRdx.tryToReduce(R, TTI, *TLI);
+ }
+ if (VectorizedV != nullptr) {
----------------
Better to keep this as lambda.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:14080
+ Instruction *FutureSeed = Inst;
+ if (TryOperandsAsNewSeeds && Inst == Root) {
+ FutureSeed = getNonPhiOperand(Root, P);
----------------
The original code does not compare with Root, it compares with P. What if Inst is an instruction with P operand, but not Root?
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:14083
+ if (!FutureSeed)
+ break;
}
----------------
Why break here?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149627/new/
https://reviews.llvm.org/D149627
More information about the llvm-commits
mailing list