llvm::getStrideFromAddRec

Return the constant step of affine AddRec AR in units of AccessTy.

Synopsis

Declared in <llvm/Analysis/LoopAccessAnalysis.h>

std::optional<int64_t>
getStrideFromAddRec(
    SCEVAddRecExpr const* AR,
    Loop const* Lp,
    Type* AccessTy,
    Value* Ptr,
    PredicatedScalarEvolution& PSE);

Description

If AR is an affine AddRec for Lp with a constant step, return the step in units of AccessTy's allocation size. Returns std::nullopt if the step is not constant, does not divide the access size, or AccessTy is a scalable vector. Ptr is only used for debug output and may be null.

Return Value

The constant step in units of AccessTy, or std::nullopt.

Parameters

NameDescription
ARCandidate affine add-recurrence for the pointer.
LpLoop that AR must be an AddRec for.
AccessTyAccess type whose allocation size scales the step.
PtrOptional pointer value used only for debug output.
PSEPredicated SCEV used to analyze AR.