[llvm] [LoopVectorize] Vectorize select-cmp reduction pattern for increasing integer induction variable (PR #67812)
Mel Chen via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 3 10:09:23 PST 2024
================
@@ -236,10 +253,26 @@ class RecurrenceDescriptor {
return Kind == RecurKind::IAnyOf || Kind == RecurKind::FAnyOf;
}
+ /// Returns true if the recurrence kind is of the form
+ /// select(cmp(),x,y) where one of (x,y) is increasing loop induction.
+ static bool isFindLastIVRecurrenceKind(RecurKind Kind) {
+ return Kind == RecurKind::IFindLastIV || Kind == RecurKind::FFindLastIV;
+ }
+
/// Returns the type of the recurrence. This type can be narrower than the
/// actual type of the Phi if the recurrence has been type-promoted.
Type *getRecurrenceType() const { return RecurrenceType; }
+ /// Returns the sentinel value used to replace the start value.
+ Value *getSentinelValue() const {
+ if (isFindLastIVRecurrenceKind(Kind)) {
----------------
Mel-Chen wrote:
Yes, it should be assertion.
9059eec7bc59ee4af1fa00ea0c66ac7145a5023e
https://github.com/llvm/llvm-project/pull/67812
More information about the llvm-commits
mailing list