[llvm] [LV] Create in-loop sub reductions (PR #147026)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 24 02:01:29 PDT 2025
================
@@ -1201,6 +1209,7 @@ bool RecurrenceDescriptor::isFixedOrderRecurrence(PHINode *Phi, Loop *TheLoop,
unsigned RecurrenceDescriptor::getOpcode(RecurKind Kind) {
switch (Kind) {
+ case RecurKind::Sub:
----------------
sdesmalen-arm wrote:
`RecurKind::Sub` should just return `Instruction::Sub` as its opcode. I can understand there are places where you still need to use an `add` instead of a `sub`, for example in the outer-reduction when it needs to combine each UF's reduction result into a single one (because each of those is negative, they need to be added instead of subtracted), but that would be a special case. That would also simplify the generated code to use `sub` rather than using an `add` and having to explicitly negate the inputs.
https://github.com/llvm/llvm-project/pull/147026
More information about the llvm-commits
mailing list