[SVE][LoopVectorize] Add option to disable tail-folding for reverse loops
authorDavid Sherwood <david.sherwood@arm.com>
Tue, 14 Mar 2023 18:15:03 +0000 (18:15 +0000)
committerDavid Sherwood <david.sherwood@arm.com>
Mon, 27 Mar 2023 14:10:15 +0000 (14:10 +0000)
commit636efd2e3508f4a39717cee75c1255a48acb8f4e
tree05dfca15af81ceefb4f732f5c1d2cc79d74509a2
parentc502d480917512db8ad15bb0595c620d19c0b396
[SVE][LoopVectorize] Add option to disable tail-folding for reverse loops

If we use tail-folding for reverse loops that contain loads
and stores then we will need to reverse the loop predicate.
This patch adds a new 'reverse' sve-tail-folding option and
ensures they are not considered 'simple'.

I did this by adding a function called
containsDecreasingPointers to AArch64TargetTransformInfo.cpp
that searches all instructions in the loop for loads or
stores with negative strides.

Differential Revision: https://reviews.llvm.org/D146128
llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
llvm/test/Transforms/LoopVectorize/AArch64/sve-tail-folding-option.ll