[IVDescriptors] Add pointer InductionDescriptors with non-constant strides (try 2)
authorPhilip Reames <preames@rivosinc.com>
Wed, 5 Apr 2023 16:26:17 +0000 (09:26 -0700)
committerPhilip Reames <listmail@philipreames.com>
Wed, 5 Apr 2023 16:32:35 +0000 (09:32 -0700)
commitc416f6700f513d86226482f47ad956ceb4e7c927
tree7fa3b4bfbe19e44294144f8cd70ba006483d51fb
parentd080b5f1737b4040aa74a5614ae01338f28cd714
[IVDescriptors] Add pointer InductionDescriptors with non-constant strides (try 2)

(JFYI - This has been heavily reframed since original attempt at landing.)

This change updates the InductionDescriptor logic to allow matching a pointer IV with a non-constant stride, but also updates the LoopVectorizer to bailout on such descriptors by default. This preserves the default vectorizer behavior.

In review, it was pointed out that there's multiple unfortunate performance implications which need to be addressed before this can be enabled. Having a flag allows us to exercise the behavior, and write test cases for logic which is otherwise unreachable (or hard to reach).

This will also enable non-constant stride pointer recurrences for other consumers. I've audited said code, and don't see any obvious issues.

Differential Revision: https://reviews.llvm.org/D147336
llvm/lib/Analysis/IVDescriptors.cpp
llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/RISCV/strided-accesses.ll
llvm/test/Transforms/LoopVectorize/pointer-induction-unroll.ll
llvm/test/Transforms/LoopVectorize/pointer-induction.ll