[llvm] [LoopVectorize] Vectorize fixed-order recurrence with vscale x 1. (PR #142772)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 07:23:53 PDT 2025


================
@@ -8564,13 +8559,17 @@ addUsersInExitBlocks(VPlan &Plan,
 /// users in the original exit block using the VPIRInstruction wrapping to the
 /// LCSSA phi.
 static void addExitUsersForFirstOrderRecurrences(
-    VPlan &Plan, SetVector<VPIRInstruction *> &ExitUsersToFix) {
+    VPlan &Plan, SetVector<VPIRInstruction *> &ExitUsersToFix, VFRange &Range) {
   VPRegionBlock *VectorRegion = Plan.getVectorLoopRegion();
   auto *ScalarPHVPBB = Plan.getScalarPreheader();
   auto *MiddleVPBB = Plan.getMiddleBlock();
   VPBuilder ScalarPHBuilder(ScalarPHVPBB);
   VPBuilder MiddleBuilder(MiddleVPBB, MiddleVPBB->getFirstNonPhi());
 
+  auto IsScalableOne = [](ElementCount VF) -> bool {
+    return VF.isScalable() && VF.getKnownMinValue() == 1;
----------------
david-arm wrote:

I think it's simpler to write this as

```
 return VF == ElementCount::getScalable(1);
```

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


More information about the llvm-commits mailing list