[llvm] [VPlan] Directly unroll VectorPointerRecipe (PR #168886)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 5 02:24:00 PST 2025


================
@@ -2504,15 +2504,12 @@ void VPVectorEndPointerRecipe::printRecipe(raw_ostream &O, const Twine &Indent,
 
 void VPVectorPointerRecipe::execute(VPTransformState &State) {
   auto &Builder = State.Builder;
-  unsigned CurrentPart = getUnrollPart(*this);
-  const DataLayout &DL = Builder.GetInsertBlock()->getDataLayout();
-  Type *IndexTy = DL.getIndexType(State.TypeAnalysis.inferScalarType(this));
   Value *Ptr = State.get(getOperand(0), VPLane(0));
-
-  Value *Increment = createStepForVF(Builder, IndexTy, State.VF, CurrentPart);
-  Value *ResultPtr = Builder.CreateGEP(getSourceElementType(), Ptr, Increment,
-                                       "", getGEPNoWrapFlags());
-
+  if (!getOffset())
+    return State.set(this, Ptr, /*IsScalar*/ true);
+  Value *Offset = State.get(getOffset(), true);
+  Value *ResultPtr = Builder.CreateGEP(getSourceElementType(), Ptr, Offset, "",
+                                       getGEPNoWrapFlags());
----------------
fhahn wrote:

Can't we just check after unolling if there's either no offset or it is zero and if so replace by the pointer operand>?

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


More information about the llvm-commits mailing list