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

Jacob Crawley via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 29 02:27:20 PDT 2026


================
@@ -559,6 +559,14 @@ bool VPInstruction::canGenerateScalarForFirstLane() const {
   }
 }
 
+Instruction::BinaryOps getSubRecurOpcode(RecurKind Kind) {
+  if (Kind == RecurKind::Sub)
+    return Instruction::Add;
+  if (Kind == RecurKind::FSub)
+    return Instruction::FAdd;
+  return (Instruction::BinaryOps)RecurrenceDescriptor::getOpcode(Kind);
----------------
jacob-crawley wrote:

Replacing the fallback to `RecurrenceDescriptor::getOpcode(Kind)` with `llvm_unreachable()` causes failures in non sub reductions. 

When the interleave factor is > 1 reductions with `RecurKind::Add` will enter the block in `ComputeReductionResult` where the helper gets called. 

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


More information about the llvm-commits mailing list