[PATCH] D49491: [RFC][VPlan, SLP] Add simple SLP analysis on top of VPlan.
Alexey Bataev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 20 10:53:32 PDT 2018
ABataev added inline comments.
================
Comment at: lib/Transforms/Vectorize/VPlan.cpp:605
VPInstruction *VPInst = cast<VPInstruction>(&*I);
- Instruction *Inst = cast<Instruction>(VPInst->getUnderlyingValue());
+ const Instruction *Inst = cast<Instruction>(VPInst->getUnderlyingValue());
auto *IG = IAI.getInterleaveGroup(Inst);
----------------
`const auto *`
================
Comment at: lib/Transforms/Vectorize/VPlanSLP.cpp:64
+
+VPInstruction *VPSlp::addCombined(SmallVector<VPValue *, 4> &Operands,
+ VPInstruction *New) {
----------------
`ArrayRef<VPValue *> Operands`
================
Comment at: lib/Transforms/Vectorize/VPlanSLP.cpp:149
+
+static SmallVector<VPValue *, 4> getOperands(SmallVectorImpl<VPValue *> &Values,
+ unsigned OperandIndex) {
----------------
`ArrayRef<VPValue *> Values`
================
Comment at: lib/Transforms/Vectorize/VPlanSLP.cpp:159
+
+static bool areCommutative(SmallVectorImpl<VPValue *> &Values) {
+ return Instruction::isCommutative(
----------------
`ArrayRef<VPValue *> Values`
================
Comment at: lib/Transforms/Vectorize/VPlanSLP.cpp:165
+static SmallVector<SmallVector<VPValue *, 4>, 4>
+getOperands(SmallVectorImpl<VPValue *> &Values) {
+ SmallVector<SmallVector<VPValue *, 4>, 4> Result;
----------------
`ArrayRef<VPValue *> Values`
================
Comment at: lib/Transforms/Vectorize/VPlanSLP.cpp:186
+/// Returns the opcode of Values or ~0 if they do not all agree.
+static Optional<unsigned> getOpcode(SmallVectorImpl<VPValue *> &Values) {
+ unsigned Opcode = cast<VPInstruction>(Values[0])->getOpcode();
----------------
`ArrayRef<VPValue *> Values`
================
Comment at: lib/Transforms/Vectorize/VPlanSLP.cpp:227-228
+ unsigned Score = 0;
+ for (unsigned i = 0, eV1 = cast<VPUser>(V1)->getNumOperands(); i < eV1; i++)
+ for (unsigned j = 0, eV2 = cast<VPUser>(V2)->getNumOperands(); j < eV2; j++)
+ Score += getLAScore(cast<VPUser>(V1)->getOperand(i),
----------------
Capitalize variables names + preincrement
================
Comment at: lib/Transforms/Vectorize/VPlanSLP.cpp:235
+static std::pair<OpMode, VPValue *>
+getBest(OpMode Mode, VPValue *Last, SmallVectorImpl<VPValue *> &Candidates,
+ VPInterleavedAccessInfo &IAI) {
----------------
`ArrayRef<VPValue *> Candidates`
================
Comment at: lib/Transforms/Vectorize/VPlanSLP.cpp:348
+
+VPInstruction *VPSlp::buildGraph(SmallVector<VPValue *, 4> &Values) {
+ assert(!Values.empty() && "Need some operands!");
----------------
`ArrayRef<VPValue *> Values`
https://reviews.llvm.org/D49491
More information about the llvm-commits
mailing list