[llvm] [LV] Handle FSub Partial Reductions (PR #191186)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 08:01:32 PDT 2026


================
@@ -8792,17 +8793,28 @@ static SmallVector<Instruction *> preparePlanForEpilogueVectorLoop(
           // Partial sub-reductions always start at 0 and account for the
           // reduction start value in a final subtraction. Update it to use the
           // resume value from the main vector loop.
-          if (PhiR->getVFScaleFactor() > 1 &&
-              PhiR->getRecurrenceKind() == RecurKind::Sub) {
+          if ((PhiR->getVFScaleFactor() > 1 &&
+               PhiR->getRecurrenceKind() == RecurKind::Sub) ||
+              PhiR->getRecurrenceKind() == RecurKind::FSub) {
             auto *Sub = cast<VPInstruction>(RdxResult->getSingleUser());
-            assert(Sub->getOpcode() == Instruction::Sub && "Unexpected opcode");
+            assert((Sub->getOpcode() == Instruction::Sub ||
----------------
fhahn wrote:



this is a bit verbose; they always need to be handled together, right? If so, would be good to add `IVDescriptor::isSubRecurrence` or something like that

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


More information about the llvm-commits mailing list