[llvm] [VPlan] Directly unroll VectorEndPointerRecipe (PR #172372)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 8 00:16:03 PST 2026


================
@@ -2913,10 +2910,21 @@ static VPRecipeBase *optimizeMaskToEVL(VPValue *HeaderMask,
 
   /// Adjust any end pointers so that they point to the end of EVL lanes not VF.
   auto AdjustEndPtr = [&CurRecipe, &EVL](VPValue *EndPtr) {
-    auto *EVLEndPtr = cast<VPVectorEndPointerRecipe>(EndPtr)->clone();
-    EVLEndPtr->insertBefore(&CurRecipe);
-    EVLEndPtr->setOperand(1, &EVL);
-    return EVLEndPtr;
+    auto *VEPR = cast<VPVectorEndPointerRecipe>(EndPtr);
+    Type *SourceElementType = VEPR->getSourceElementType();
+    GEPNoWrapFlags NW = VEPR->getGEPNoWrapFlags();
+    VPBuilder Builder(&CurRecipe);
+    return Builder.createVectorEndPointerRecipe(VEPR->getOperand(0),
+                                                SourceElementType, -1, NW, &EVL,
+                                                VEPR->getDebugLoc());
+  };
+
+  auto m_VecEndPtrVF = [&Plan](VPValue *&Addr) {
+    return m_VecEndPtr(
+        m_VPValue(Addr),
+        m_c_Mul(m_AllOnes(),
----------------
artagnon wrote:

Not sure I follow: if I understand correctly, the newly-created experimental_vp_reverse doesn't take a stride, and the stride is implictly 1 (or -1 reversed?).

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


More information about the llvm-commits mailing list