[LV] Support fixed order recurrences.
authorFlorian Hahn <flo@fhahn.com>
Thu, 18 Aug 2022 18:15:51 +0000 (19:15 +0100)
committerFlorian Hahn <flo@fhahn.com>
Thu, 18 Aug 2022 18:15:52 +0000 (19:15 +0100)
commitb8709a9d03f8ba28146f612aa47cc25a44d0723e
treea3e8828a176473b36793a57a4015ba6cd003374c
parent1436adae2ca62dbd18f39eee71c9d1de85f34fd0
[LV] Support fixed order recurrences.

If the incoming previous value of a fixed-order recurrence is a phi in
the header, go through incoming values from the latch until we find a
non-phi value. Use this as the new Previous, all uses in the header
will be dominated by the original phi, but need to be moved after
the non-phi previous value.

At the moment, fixed-order recurrences are modeled as a chain of
first-order recurrences.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D119661
llvm/include/llvm/Analysis/IVDescriptors.h
llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
llvm/lib/Analysis/IVDescriptors.cpp
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains-vplan.ll [new file with mode: 0644]
llvm/test/Transforms/LoopVectorize/first-order-recurrence-chains.ll
llvm/test/Transforms/LoopVectorize/first-order-recurrence.ll