[PATCH] D113782: [SLP]Improve cost model for the shuffled extracts.
Simon Pilgrim via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 1 06:01:35 PST 2021
RKSimon added inline comments.
================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:5425
+ } while (E == getTreeEntry(Base));
+ }
+ FirstUsers.push_back(VU);
----------------
ABataev wrote:
> RKSimon wrote:
> > Should this be put inside the while() loop before the break? AFAICT that's the only time that cast<InsertElementInst>(Base) is valid.
> No, not quite so. It can be insertelement also if `ScalarToTreeEntry.count(Base)` is true, i.e. there is a tree entry for this insertelement in the graph.
I don't quite follow, this is what I had in mind:
```
// Find the insertvector, vectorized in tree, if any.
Value *Base = VU;
while (isa<InsertElementInst>(Base)) {
if (ScalarToTreeEntry.count(Base)) {
VU = Base;
// Build the mask for the vectorized insertelement instructions.
if (const TreeEntry *E = getTreeEntry(Base)) {
do {
int Idx = E->findLaneForValue(Base);
ShuffleMask.back()[Idx] = Idx;
Base = cast<InsertElementInst>(Base)->getOperand(0);
} while (E == getTreeEntry(Base));
}
break;
}
Base = cast<InsertElementInst>(Base)->getOperand(0);
}
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113782/new/
https://reviews.llvm.org/D113782
More information about the llvm-commits
mailing list