[llvm] [VPlan] Use DL index type consistently for GEPs (PR #169396)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 26 02:45:00 PST 2025
================
@@ -2593,22 +2593,12 @@ void VPWidenGEPRecipe::printRecipe(raw_ostream &O, const Twine &Indent,
}
#endif
-static Type *getGEPIndexTy(bool IsScalable, bool IsReverse, bool IsUnitStride,
- unsigned CurrentPart, IRBuilderBase &Builder) {
- // Use i32 for the gep index type when the value is constant,
- // or query DataLayout for a more suitable index type otherwise.
- const DataLayout &DL = Builder.GetInsertBlock()->getDataLayout();
- return !IsUnitStride || (IsScalable && (IsReverse || CurrentPart > 0))
- ? DL.getIndexType(Builder.getPtrTy(0))
- : Builder.getInt32Ty();
-}
-
void VPVectorEndPointerRecipe::execute(VPTransformState &State) {
auto &Builder = State.Builder;
unsigned CurrentPart = getUnrollPart(*this);
- bool IsUnitStride = Stride == 1 || Stride == -1;
- Type *IndexTy = getGEPIndexTy(State.VF.isScalable(), /*IsReverse*/ true,
- IsUnitStride, CurrentPart, Builder);
+ Value *Ptr = State.get(getOperand(0), VPLane(0));
+ const DataLayout &DL = Builder.GetInsertBlock()->getDataLayout();
+ Type *IndexTy = DL.getIndexType(Ptr->getType());
----------------
fhahn wrote:
Could you directly use the type from the type inferrence here?
https://github.com/llvm/llvm-project/pull/169396
More information about the llvm-commits
mailing list