[llvm] [LV] Create in-loop sub reductions (PR #147026)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 17 10:15:09 PDT 2025


================
@@ -9144,6 +9144,15 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
             CurrentLinkI->getFastMathFlags());
         LinkVPBB->insert(FMulRecipe, CurrentLink->getIterator());
         VecOp = FMulRecipe;
+      } else if (PhiR->isInLoop() && Kind == RecurKind::Sub &&
+                 CurrentLinkI->getOpcode() == Instruction::Sub) {
----------------
MacDue wrote:

I'm guessing this is something to do with the input of the `lvm.vector.reduce.add` in the loop?

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


More information about the llvm-commits mailing list