[llvm] [IVDescriptors][NFC] Refactor getReductionOpChain to remove the dependency of non-arithmetic reductions on getOpcode. (PR #118777)

Mel Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 3 00:38:09 PST 2025


================
@@ -1063,7 +1068,7 @@ unsigned RecurrenceDescriptor::getOpcode(RecurKind Kind) {
 SmallVector<Instruction *, 4>
 RecurrenceDescriptor::getReductionOpChain(PHINode *Phi, Loop *L) const {
   SmallVector<Instruction *, 4> ReductionOperations;
-  unsigned RedOp = getOpcode();
+  bool IsNonArithmetic = !isArithmeticRecurrenceKind(Kind);
----------------
Mel-Chen wrote:

Hmm, I don't want to call `getOpcode` for every recurrences. How about adding `isComparisonRecurrenceKind` function?

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


More information about the llvm-commits mailing list