The "getVectorizablePrefix" method would give up if it found an aliasing load for a store chain.
In practice, the aliasing load can be treated as a memory barrier and all stores that precede it
are a valid vectorizable prefix.
Issue found by volkan in D26962. Testcase is a pruned version of the one in the original patch.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
| lib/Transforms/Vectorize/LoadStoreVectorizer.cpp | ||
|---|---|---|
| 486 ↗ | (On Diff #78967) | Nit, pls end sentences with periods. |
| 490 ↗ | (On Diff #78967) | Can we add a comment on this loop to the effect of:
|
| 529 ↗ | (On Diff #78967) | As discussed IRL, not sure why we need this early-break at all. |
| lib/Transforms/Vectorize/LoadStoreVectorizer.cpp | ||
|---|---|---|
| 529 ↗ | (On Diff #78967) | This a legality condition. It relates to the above comment: We consider loads before stores safe. This patch will somewhat relax this condition, but only for stores. First, store chains: |
As we discussed, I want to try splitting out this loop into a load and a store version to see if it clarifies things, but I'm happy to do that as a separate patch. This lgtm.
| lib/Transforms/Vectorize/LoadStoreVectorizer.cpp | ||
|---|---|---|
| 535 ↗ | (On Diff #79003) | I'd either get rid of the second paragraph here or encode it as an assert. |