[llvm] IVDesc: unify RecurKinds IAnyOf and FAnyOf (PR #118393)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 14 08:55:01 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:
Hmm, it's pretty confusing having Instruction::getOpcode and RecurrenceDescriptor::getOpcode. I see now that `isRecurrenceInstr` calls the Instruction version. So if #118777 lands `getOpcode` in this PR will still return the wrong value, but simply won't get called in lib/Analysis/IVDescriptors.cpp. However, `getOpcode` will still be incorrect if called anywhere else and so there will still be a hidden bug in the code. Essentially it looks like the static version of `RecurrenceDescriptor::getOpcode` is returning the opcode at the start of the chain of operations, e.g. RecurKind::SMin returns icmp too rather than the select operation which is at the end. If `getOpcode` requires the type used at the start of the chain, then presumably we should be passing in that type instead?
https://github.com/llvm/llvm-project/pull/118393
More information about the llvm-commits
mailing list