[PATCH] D27008: [LoadStoreVectorizer] Enable vectorization of stores in the presence of an aliasing load
Alina Sbirlea via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 22 16:32:54 PST 2016
asbirlea added inline comments.
================
Comment at: lib/Transforms/Vectorize/LoadStoreVectorizer.cpp:529
+ // Continue the search only for store chains
+ if (IsLoadChain && BarrierMemoryInstr)
break;
----------------
jlebar wrote:
> As discussed IRL, not sure why we need this early-break at all.
This a legality condition. It relates to the above comment:
"We can ignore the alias as long as the load comes before the store, because that means we won't be moving the load past the store [...]"
We consider loads before stores safe. This patch will somewhat relax this condition, but only for stores. First, store chains:
If a load comes before the store it's safe per above comment/condition. If a load comes after the store, we allow some leniency and don't break right away to enable vectorization of all stores that precede the "guilty" load.
Now, for load chains:
If the load comes before, again it's safe. But if we find a store that aliases, we _must_ stop processing and not take any loads that follow that store. The vectorized load will be moved at the location of the first load found, pulling up a load past an aliasing store. This produces incorrect code if the load it pulls up aliases the store(s) above it, a check that we don't make right now.
There may be room for further improvement with additional checks, but for now, don't do this.
https://reviews.llvm.org/D27008
More information about the llvm-commits
mailing list