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

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 16 03:47:17 PST 2025


================
@@ -209,7 +207,9 @@ class RecurrenceDescriptor {
 
   RecurKind getRecurrenceKind() const { return Kind; }
 
-  unsigned getOpcode() const { return getOpcode(getRecurrenceKind()); }
+  unsigned getOpcode() const {
+    return getOpcode(getRecurrenceKind(), getRecurrenceType());
----------------
david-arm wrote:

Yeah I understand and cleaning up this code sounds like a very good idea! So I was thinking about this the other day and one possible solution is to change the definition of `getOpcode` to return the opcode of the instruction that forms the actual PHI update. In this case, for min/max/anyof recurrence types that will always be a select (I think?), and in that case there is no need to pass in the recurrence type. Although, as you say reducing reliance on `getOpcode()` is a good thing to do anyway.

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


More information about the llvm-commits mailing list