Improved effectively for a constant offset GEP if the scalable index is same.
getelementptr <vscale x 4 x i32>, ptr %p, i64 1, i64 %i getelementptr <vscale x 4 x i32>, ptr %p, i64 1, i64 %j
Allen on Sep 14 2022, 1:58 AM.Authored by
If you want to support this, it must be part of GEP decomposition.
If you are only interested in constants for the vscale index, then it's probably possible to support this with relatively low effort by using a VariableGEPIndex with a vscale constant expression. That should allow all the existing modelling to handle it (possibly including range analysis based on vscale_range attributes).
If you are interested in variables for the vscale index, then this won't work, and it would be necessary to add first class vscale support to VariableGEPIndex (i.e. a separate bool, which all code working on decomposed GEPs has to handle in the appropriate way).
I don't get how this patch is supposed to work. It seems to create a VariableGEPIndex -- but I don't see the vscale factor represented anywhere in there?
Worth noting that https://reviews.llvm.org/D134648 plans to make vscale non-constant, so making the use of vscale constant expressions is likely not going to be possible going forward...