Skip to content

Commit 76fa457

Browse files
committed
[IVDescriptors] Identify min/max recurrences in single pass.
This patch ties to extend the approach from llvm#141431 to all min/max recurrence kinds. This patch adds a new getMinMaxRecurrence that identifies all min/max recurrences in a single pass. It starts at the backedge value of a phi and tries to identify the kind of the min/max recurrences. It then walks from the backedge value to its operands recursively until it reaches out-of-loop values or the phi. Then users of both the backedge value and all instructions in the chain from backedge value to phi are checked. This consolidates all logic to identify min/max recurrences to a single function, and avoids the need to try to identify each min/max reduction kind individually.
1 parent 0fefa56 commit 76fa457

File tree

2 files changed

+180
-180
lines changed

2 files changed

+180
-180
lines changed

llvm/include/llvm/Analysis/IVDescriptors.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,14 +155,6 @@ class RecurrenceDescriptor {
155155
LLVM_ABI static bool areAllUsesIn(Instruction *I,
156156
SmallPtrSetImpl<Instruction *> &Set);
157157

158-
/// Returns a struct describing if the instruction is a llvm.(s/u)(min/max),
159-
/// llvm.minnum/maxnum or a Select(ICmp(X, Y), X, Y) pair of instructions
160-
/// corresponding to a min(X, Y) or max(X, Y), matching the recurrence kind \p
161-
/// Kind. \p Prev specifies the description of an already processed select
162-
/// instruction, so its corresponding cmp can be matched to it.
163-
LLVM_ABI static InstDesc isMinMaxPattern(Instruction *I, RecurKind Kind,
164-
const InstDesc &Prev);
165-
166158
/// Returns a struct describing whether the instruction is either a
167159
/// Select(ICmp(A, B), X, Y), or
168160
/// Select(FCmp(A, B), X, Y)

0 commit comments

Comments
 (0)