[PATCH] D22119: Extended LoadStoreVectorizer to vectorize subchains.
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 12 16:08:31 PDT 2016
asbirlea marked 6 inline comments as done.
================
Comment at: lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:112
@@ +111,3 @@
+ /// \p Chain[0, Index) is the largest vectorizable chain prefix. The elements
+ /// of \p Chain should be all loads or all stores.
+ unsigned getVectorizableEnd(ArrayRef<Value *> Chain, BasicBlock::iterator From,
----------------
Well, it still applies. It's still checking for the existance of those instructions but using the info differently. I shortened the comment somewhat.
================
Comment at: lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:356
@@ -352,3 +355,3 @@
assert(IM->getParent() == IW->getParent() &&
"Instructions to move should be in the same basic block");
}
----------------
Because I accidentally did the updates on this one some time ago :). Then I redid them on the other one.
================
Comment at: lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:449-455
@@ -445,8 +448,9 @@
- for (auto EntryMem : MemoryInstrs) {
- Value *V = EntryMem.first;
- unsigned VIdx = EntryMem.second;
- for (auto EntryChain : ChainInstrs) {
- Value *VV = EntryChain.first;
- unsigned VVIdx = EntryChain.second;
+ unsigned Index = 0;
+ for (auto EntryChain : ChainInstrs) {
+ Value *VV = EntryChain.first;
+ unsigned VVIdx = EntryChain.second;
+ for (auto EntryMem : MemoryInstrs) {
+ Value *V = EntryMem.first;
+ unsigned VIdx = EntryMem.second;
if (isa<LoadInst>(V) && isa<LoadInst>(VV))
----------------
Also updated VV/V and VVIdx/VIdx. They still need different names from InstrIndx, since the same index is used for both Chain and Mem in the loop above, and now we need two.
================
Comment at: lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:623-632
@@ -618,4 +622,12 @@
- for (int Head : Heads) {
- if (Tails.count(Head))
+ for (unsigned i = 0; i < Heads.size(); i++) {
+ int Head = Heads[i];
+ if (VectorizedValues.count(Instrs[Head]))
+ continue;
+ for (unsigned j = 0; j < Tails.size(); j++)
+ if (Head == Tails[j] && !VectorizedValues.count(Instrs[Heads[j]])) {
+ Head = -1;
+ break;
+ }
+ if (Head < 0)
continue;
----------------
For Heads it's fine to use the range-based loop (updated). For Tails I need the iterator to get Heads[TailsIterator].
http://reviews.llvm.org/D22119
More information about the llvm-commits
mailing list