[llvm] [VPlan] Directly unroll VectorEndPointerRecipe (PR #172372)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 5 06:47:41 PST 2026
================
@@ -2992,10 +2992,19 @@ 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);
+ VPBuilder Builder(&CurRecipe);
+ return Builder.createVectorEndPointerRecipe(
+ VEPR->getOperand(0), VEPR->getSourceElementType(), VEPR->getStride(),
+ VEPR->getGEPNoWrapFlags(), &EVL, VEPR->getDebugLoc());
+ };
+
+ auto m_VecEndPtrVF = [&Plan](VPValue *&Addr, int64_t Stride) { // NOLINT
+ return m_VecEndPtr(
+ m_VPValue(Addr),
+ m_c_Mul(
+ m_SpecificSInt(Stride),
+ m_Sub(m_ZExtOrTruncOrSelf(m_Specific(&Plan->getVF())), m_One())));
};
----------------
fhahn wrote:
this complicaion comes from the fact that we now always generate the explicit offse.
could we instead keep the vf operand, and just have add the expanded stride after unrolling to keep things simpler early on, similar to https://github.com/llvm/llvm-project/pull/170906?
we would make sure to materialize the offset even without unrolling, but that can be done in convertToConcreteRecipes for example
https://github.com/llvm/llvm-project/pull/172372
More information about the llvm-commits
mailing list