[llvm] [LV] Bundle partial reductions inside VPExpressionRecipe (PR #147302)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 15 00:07:18 PDT 2025


minxuanz wrote:

#162922 Hi, this issue may relate to this , i think should add hasNUsesOrMore check ,Could you take a look?
```
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index 9bb88205009c..a566b3f09d10 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -2880,10 +2880,12 @@ void VPlanTransforms::replaceSymbolicStrides(
     if (VPValue *StrideVPV = Plan.getLiveIn(StrideV))
       StrideVPV->replaceUsesWithIf(CI, CanUseVersionedStride);
 
+    if (!StrideV->hasNUsesOrMore(1))
+      continue;
     // The versioned value may not be used in the loop directly but through a
     // sext/zext. Add new live-ins in those cases.
     for (Value *U : StrideV->users()) {
-      if (!isa<SExtInst, ZExtInst>(U))
+      if (!isa_and_nonnull<SExtInst, ZExtInst>(U))
         continue;
       VPValue *StrideVPV = Plan.getLiveIn(U);
       if (!StrideVPV)

```

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


More information about the llvm-commits mailing list