Skip to content

Commit 780f58f

Browse files
committed
[VPlan] Inline getGEPIndexTy
1 parent 76eaea6 commit 780f58f

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2593,15 +2593,12 @@ void VPWidenGEPRecipe::printRecipe(raw_ostream &O, const Twine &Indent,
25932593
}
25942594
#endif
25952595

2596-
static Type *getGEPIndexTy(IRBuilderBase &Builder) {
2597-
const DataLayout &DL = Builder.GetInsertBlock()->getDataLayout();
2598-
return DL.getIndexType(Builder.getPtrTy(0));
2599-
}
2600-
26012596
void VPVectorEndPointerRecipe::execute(VPTransformState &State) {
26022597
auto &Builder = State.Builder;
26032598
unsigned CurrentPart = getUnrollPart(*this);
2604-
Type *IndexTy = getGEPIndexTy(Builder);
2599+
Value *Ptr = State.get(getOperand(0), VPLane(0));
2600+
const DataLayout &DL = Builder.GetInsertBlock()->getDataLayout();
2601+
Type *IndexTy = DL.getIndexType(Ptr->getType());
26052602

26062603
// The wide store needs to start at the last vector element.
26072604
Value *RunTimeVF = State.get(getVFValue(), VPLane(0));
@@ -2614,7 +2611,6 @@ void VPVectorEndPointerRecipe::execute(VPTransformState &State) {
26142611
Value *LastLane = Builder.CreateSub(RunTimeVF, ConstantInt::get(IndexTy, 1));
26152612
if (Stride != 1)
26162613
LastLane = Builder.CreateMul(ConstantInt::get(IndexTy, Stride), LastLane);
2617-
Value *Ptr = State.get(getOperand(0), VPLane(0));
26182614
Value *ResultPtr =
26192615
Builder.CreateGEP(IndexedTy, Ptr, NumElt, "", getGEPNoWrapFlags());
26202616
ResultPtr = Builder.CreateGEP(IndexedTy, ResultPtr, LastLane, "",
@@ -2637,8 +2633,9 @@ void VPVectorEndPointerRecipe::printRecipe(raw_ostream &O, const Twine &Indent,
26372633
void VPVectorPointerRecipe::execute(VPTransformState &State) {
26382634
auto &Builder = State.Builder;
26392635
unsigned CurrentPart = getUnrollPart(*this);
2640-
Type *IndexTy = getGEPIndexTy(Builder);
26412636
Value *Ptr = State.get(getOperand(0), VPLane(0));
2637+
const DataLayout &DL = Builder.GetInsertBlock()->getDataLayout();
2638+
Type *IndexTy = DL.getIndexType(Ptr->getType());
26422639

26432640
Value *Increment = createStepForVF(Builder, IndexTy, State.VF, CurrentPart);
26442641
Value *ResultPtr = Builder.CreateGEP(getSourceElementType(), Ptr, Increment,

0 commit comments

Comments
 (0)