[llvm] IVDesc: unify RecurKinds IAnyOf and FAnyOf (PR #118393)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 03:27:22 PST 2024


================
@@ -500,7 +497,7 @@ bool RecurrenceDescriptor::AddReductionVar(
   // This means we have seen one but not the other instruction of the
   // pattern or more than just a select and cmp. Zero implies that we saw a
   // llvm.min/max intrinsic, which is always OK.
-  if (isMinMaxRecurrenceKind(Kind) && NumCmpSelectPatternInst != 2 &&
+  if (isMinMaxRecurrenceKind(Kind) && NumCmpSelectPatternInst != 1 &&
----------------
artagnon wrote:

It's about incrementing NumCmpSelectPatternInst when we see a select() or cmp() versus incrementing it when we see a select(cmp()). In the case of MinMax, cmp() is a legitimate user of the reduction phi, while in the case of AnyOf, we had an artificial restriction on cmp() not being a user of the reduction phi (however, the IAnyOf case is matched in the FAnyOf case, when fcmp() fails to match, and vice-versa: hence, this patch does not affect code generation).

https://github.com/llvm/llvm-project/pull/118393


More information about the llvm-commits mailing list