[PATCH] D147783: [VPlan] Add stride->constant VPlan mapping at construction.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 25 13:18:31 PDT 2023
fhahn updated this revision to Diff 516880.
fhahn marked 2 inline comments as done.
fhahn added a comment.
Rebase and ping :)
In D147783#4265589 <https://reviews.llvm.org/D147783#4265589>, @reames wrote:
> A couple points here.
Thanks for taking a look!
> 1. The restriction to constant strides is unfortunate. We only speculate on constant equality today, but there are other reasonable speculations we could make. For instance, given a loop with two independent strided IVs, we might speculate they are equal.
There is no need to restrict this to constant strides; if it is not constant (and not SCEVUnknown) then we would need to expand the SCEV, which can be done by introducing a VPExpandSCEVRecipe to take care of that.
> 2. This feels somewhat like you're reinventing the wheel. The whole point of PSE is that you can ask it to simplify a SCEV expression. Anywhere we have a SCEV expression, we should probably be using it to optimize the result before generating vectorized code. The stride speculation is only one of multiple assumption types PSE has. I suspect - though don't have a test case - that the overflow flags might also lead to interesting speculations.
We are moving towards modeling SCEV expansion explicitly in VPlan (this is already the case for expanding steps of inductions used in the plan). One the one hand this takes care of the issues we have with querying/expanding SCEVs while we already modified the CFG (and it is in an temporary invalid state). On the other hand this would also make it very easy to re-query PSE for all used SCEVs down the line.
For this particular case, there's no SCEV expressions for the strides if it is used outside of inductions, so taking care of that using a mapping seems good first step to me. WDYT?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D147783/new/
https://reviews.llvm.org/D147783
Files:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/VPlan.h
llvm/test/Transforms/LoopVectorize/ARM/mve-gather-scatter-tailpred.ll
llvm/test/Transforms/LoopVectorize/RISCV/strided-accesses.ll
llvm/test/Transforms/LoopVectorize/runtime-check-needed-but-empty.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147783.516880.patch
Type: text/x-patch
Size: 15359 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230425/c1be40d5/attachment.bin>
More information about the llvm-commits
mailing list