[PATCH] D147783: [VPlan] Add stride->constant VPlan mapping at construction.

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 13 09:00:09 PDT 2023


reames added a comment.

A couple points here.

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.

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.

On (2), be warned.  I am not real comfortable with the PSE code quality.  I'm reasonable sure we have bugs lurking that might be exposed if we started using it significantly more widely.  Most of our usage in LV today is for generating checks and costing, adding it to the code generation path might cause some fallout.  (And this is probably the biggest argument for not using PSE.  I'm open to that argument, I'd just like to see it discussed explicitly.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147783/new/

https://reviews.llvm.org/D147783



More information about the llvm-commits mailing list