class ScalarEvolution

Declaration

class ScalarEvolution { /* full declaration omitted */ };

Description

The main scalar evolution driver. Because client code (intentionally) can't do much with the SCEV objects directly, they must ask this class for services.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:441

Method Overview

  • public uint32_t GetMinTrailingZeros(const llvm::SCEV * S)
  • public ScalarEvolution(llvm::Function & F, llvm::TargetLibraryInfo & TLI, llvm::AssumptionCache & AC, llvm::DominatorTree & DT, llvm::LoopInfo & LI)
  • public ScalarEvolution(llvm::ScalarEvolution && Arg)
  • public bool SimplifyICmpOperands(ICmpInst::Predicate & Pred, const llvm::SCEV *& LHS, const llvm::SCEV *& RHS, unsigned int Depth = 0)
  • public std::pair<const SCEV *, const SCEV *> SplitIntoInitAndPostInc(const llvm::Loop * L, const llvm::SCEV * S)
  • public static SCEV::NoWrapFlags clearFlags(SCEV::NoWrapFlags Flags, SCEV::NoWrapFlags OffFlags)
  • public void collectParametricTerms(const llvm::SCEV * Expr, SmallVectorImpl<const llvm::SCEV *> & Terms)
  • public void computeAccessFunctions(const llvm::SCEV * Expr, SmallVectorImpl<const llvm::SCEV *> & Subscripts, SmallVectorImpl<const llvm::SCEV *> & Sizes)
  • public bool containsAddRecurrence(const llvm::SCEV * S)
  • public const llvm::SCEVAddRecExpr * convertSCEVToAddRecWithPredicates(const llvm::SCEV * S, const llvm::Loop * L, SmallPtrSetImpl<const llvm::SCEVPredicate *> & Preds)
  • public Optional<std::pair<const SCEV *, SmallVector<const SCEVPredicate *, 3>>> createAddRecFromPHIWithCasts(const llvm::SCEVUnknown * SymbolicPHI)
  • public void delinearize(const llvm::SCEV * Expr, SmallVectorImpl<const llvm::SCEV *> & Subscripts, SmallVectorImpl<const llvm::SCEV *> & Sizes, const llvm::SCEV * ElementSize)
  • public bool dominates(const llvm::SCEV * S, const llvm::BasicBlock * BB)
  • public void eraseValueFromMap(llvm::Value * V)
  • public void findArrayDimensions(SmallVectorImpl<const llvm::SCEV *> & Terms, SmallVectorImpl<const llvm::SCEV *> & Sizes, const llvm::SCEV * ElementSize)
  • public void forgetAllLoops()
  • public void forgetLoop(const llvm::Loop * L)
  • public void forgetLoopDispositions(const llvm::Loop * L)
  • public void forgetTopmostLoop(const llvm::Loop * L)
  • public void forgetValue(llvm::Value * V)
  • public const llvm::SCEV * getAddExpr(SmallVectorImpl<const llvm::SCEV *> & Ops, SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap, unsigned int Depth = 0)
  • public const llvm::SCEV * getAddExpr(const llvm::SCEV * LHS, const llvm::SCEV * RHS, SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap, unsigned int Depth = 0)
  • public const llvm::SCEV * getAddExpr(const llvm::SCEV * Op0, const llvm::SCEV * Op1, const llvm::SCEV * Op2, SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap, unsigned int Depth = 0)
  • public const llvm::SCEV * getAddRecExpr(SmallVectorImpl<const llvm::SCEV *> & Operands, const llvm::Loop * L, SCEV::NoWrapFlags Flags)
  • public const llvm::SCEV * getAddRecExpr(const llvm::SCEV * Start, const llvm::SCEV * Step, const llvm::Loop * L, SCEV::NoWrapFlags Flags)
  • public const llvm::SCEV * getAddRecExpr(const SmallVectorImpl<const llvm::SCEV *> & Operands, const llvm::Loop * L, SCEV::NoWrapFlags Flags)
  • public const llvm::SCEV * getAnyExtendExpr(const llvm::SCEV * Op, llvm::Type * Ty)
  • public const llvm::SCEV * getBackedgeTakenCount(const llvm::Loop * L, llvm::ScalarEvolution::ExitCountKind Kind = Exact)
  • public llvm::ScalarEvolution::BlockDisposition getBlockDisposition(const llvm::SCEV * S, const llvm::BasicBlock * BB)
  • public const llvm::SCEV * getConstant(llvm::Type * Ty, uint64_t V, bool isSigned = false)
  • public const llvm::SCEV * getConstant(const llvm::APInt & Val)
  • public const llvm::SCEV * getConstant(llvm::ConstantInt * V)
  • public const llvm::SCEV * getConstantMaxBackedgeTakenCount(const llvm::Loop * L)
  • public llvm::LLVMContext & getContext() const
  • public const llvm::SCEV * getCouldNotCompute()
  • public const llvm::DataLayout & getDataLayout() const
  • public llvm::Type * getEffectiveSCEVType(llvm::Type * Ty) const
  • public const llvm::SCEV * getElementSize(llvm::Instruction * Inst)
  • public const llvm::SCEVPredicate * getEqualPredicate(const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public const llvm::SCEV * getExitCount(const llvm::Loop * L, llvm::BasicBlock * ExitingBlock, llvm::ScalarEvolution::ExitCountKind Kind = Exact)
  • public const llvm::SCEV * getGEPExpr(llvm::GEPOperator * GEP, const SmallVectorImpl<const llvm::SCEV *> & IndexExprs)
  • public llvm::ScalarEvolution::LoopDisposition getLoopDisposition(const llvm::SCEV * S, const llvm::Loop * L)
  • public const llvm::SCEV * getMinMaxExpr(unsigned int Kind, SmallVectorImpl<const llvm::SCEV *> & Operands)
  • public const llvm::SCEV * getMinusSCEV(const llvm::SCEV * LHS, const llvm::SCEV * RHS, SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap, unsigned int Depth = 0)
  • public const llvm::SCEV * getMulExpr(const llvm::SCEV * LHS, const llvm::SCEV * RHS, SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap, unsigned int Depth = 0)
  • public const llvm::SCEV * getMulExpr(const llvm::SCEV * Op0, const llvm::SCEV * Op1, const llvm::SCEV * Op2, SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap, unsigned int Depth = 0)
  • public const llvm::SCEV * getMulExpr(SmallVectorImpl<const llvm::SCEV *> & Ops, SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap, unsigned int Depth = 0)
  • public const llvm::SCEV * getNegativeSCEV(const llvm::SCEV * V, SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap)
  • public const llvm::SCEV * getNoopOrAnyExtend(const llvm::SCEV * V, llvm::Type * Ty)
  • public const llvm::SCEV * getNoopOrSignExtend(const llvm::SCEV * V, llvm::Type * Ty)
  • public const llvm::SCEV * getNoopOrZeroExtend(const llvm::SCEV * V, llvm::Type * Ty)
  • public const llvm::SCEV * getNotSCEV(const llvm::SCEV * V)
  • public const llvm::SCEV * getOffsetOfExpr(llvm::Type * IntTy, llvm::StructType * STy, unsigned int FieldNo)
  • public const llvm::SCEV * getOne(llvm::Type * Ty)
  • public const llvm::SCEV * getPointerBase(const llvm::SCEV * V)
  • public const llvm::SCEV * getPredicatedBackedgeTakenCount(const llvm::Loop * L, llvm::SCEVUnionPredicate & Predicates)
  • public const llvm::SCEV * getSCEV(llvm::Value * V)
  • public const llvm::SCEV * getSCEVAtScope(llvm::Value * V, const llvm::Loop * L)
  • public const llvm::SCEV * getSCEVAtScope(const llvm::SCEV * S, const llvm::Loop * L)
  • public const llvm::SCEV * getSMaxExpr(const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public const llvm::SCEV * getSMaxExpr(SmallVectorImpl<const llvm::SCEV *> & Operands)
  • public const llvm::SCEV * getSMinExpr(const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public const llvm::SCEV * getSMinExpr(SmallVectorImpl<const llvm::SCEV *> & Operands)
  • public const llvm::SCEV * getSignExtendExpr(const llvm::SCEV * Op, llvm::Type * Ty, unsigned int Depth = 0)
  • public llvm::ConstantRange getSignedRange(const llvm::SCEV * S)
  • public llvm::APInt getSignedRangeMax(const llvm::SCEV * S)
  • public llvm::APInt getSignedRangeMin(const llvm::SCEV * S)
  • public const llvm::SCEV * getSizeOfExpr(llvm::Type * IntTy, llvm::Type * AllocTy)
  • public unsigned int getSmallConstantMaxTripCount(const llvm::Loop * L)
  • public unsigned int getSmallConstantTripCount(const llvm::Loop * L)
  • public unsigned int getSmallConstantTripCount(const llvm::Loop * L, llvm::BasicBlock * ExitingBlock)
  • public unsigned int getSmallConstantTripMultiple(const llvm::Loop * L)
  • public unsigned int getSmallConstantTripMultiple(const llvm::Loop * L, llvm::BasicBlock * ExitingBlock)
  • public const llvm::SCEV * getTruncateExpr(const llvm::SCEV * Op, llvm::Type * Ty, unsigned int Depth = 0)
  • public const llvm::SCEV * getTruncateOrNoop(const llvm::SCEV * V, llvm::Type * Ty)
  • public const llvm::SCEV * getTruncateOrSignExtend(const llvm::SCEV * V, llvm::Type * Ty, unsigned int Depth = 0)
  • public const llvm::SCEV * getTruncateOrZeroExtend(const llvm::SCEV * V, llvm::Type * Ty, unsigned int Depth = 0)
  • public uint64_t getTypeSizeInBits(llvm::Type * Ty) const
  • public const llvm::SCEV * getUDivExactExpr(const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public const llvm::SCEV * getUDivExpr(const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public const llvm::SCEV * getUMaxExpr(SmallVectorImpl<const llvm::SCEV *> & Operands)
  • public const llvm::SCEV * getUMaxExpr(const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public const llvm::SCEV * getUMaxFromMismatchedTypes(const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public const llvm::SCEV * getUMinExpr(SmallVectorImpl<const llvm::SCEV *> & Operands)
  • public const llvm::SCEV * getUMinExpr(const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public const llvm::SCEV * getUMinFromMismatchedTypes(SmallVectorImpl<const llvm::SCEV *> & Ops)
  • public const llvm::SCEV * getUMinFromMismatchedTypes(const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public const llvm::SCEV * getURemExpr(const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public const llvm::SCEV * getUnknown(llvm::Value * V)
  • public llvm::ConstantRange getUnsignedRange(const llvm::SCEV * S)
  • public llvm::APInt getUnsignedRangeMax(const llvm::SCEV * S)
  • public llvm::APInt getUnsignedRangeMin(const llvm::SCEV * S)
  • public llvm::Type * getWiderType(llvm::Type * Ty1, llvm::Type * Ty2) const
  • public const llvm::SCEVPredicate * getWrapPredicate(const llvm::SCEVAddRecExpr * AR, SCEVWrapPredicate::IncrementWrapFlags AddedFlags)
  • public const llvm::SCEV * getZero(llvm::Type * Ty)
  • public const llvm::SCEV * getZeroExtendExpr(const llvm::SCEV * Op, llvm::Type * Ty, unsigned int Depth = 0)
  • public bool hasComputableLoopEvolution(const llvm::SCEV * S, const llvm::Loop * L)
  • public bool hasLoopInvariantBackedgeTakenCount(const llvm::Loop * L)
  • public bool hasOperand(const llvm::SCEV * S, const llvm::SCEV * Op) const
  • public bool invalidate(llvm::Function & F, const llvm::PreservedAnalyses & PA, FunctionAnalysisManager::Invalidator & Inv)
  • public bool isAvailableAtLoopEntry(const llvm::SCEV * S, const llvm::Loop * L)
  • public bool isBackedgeTakenCountMaxOrZero(const llvm::Loop * L)
  • public bool isKnownNegative(const llvm::SCEV * S)
  • public bool isKnownNonNegative(const llvm::SCEV * S)
  • public bool isKnownNonPositive(const llvm::SCEV * S)
  • public bool isKnownNonZero(const llvm::SCEV * S)
  • public bool isKnownOnEveryIteration(ICmpInst::Predicate Pred, const llvm::SCEVAddRecExpr * LHS, const llvm::SCEV * RHS)
  • public bool isKnownPositive(const llvm::SCEV * S)
  • public bool isKnownPredicate(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public bool isKnownViaInduction(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public bool isLoopBackedgeGuardedByCond(const llvm::Loop * L, ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public bool isLoopEntryGuardedByCond(const llvm::Loop * L, ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public bool isLoopInvariant(const llvm::SCEV * S, const llvm::Loop * L)
  • public bool isLoopInvariantPredicate(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::Loop * L, ICmpInst::Predicate & InvariantPred, const llvm::SCEV *& InvariantLHS, const llvm::SCEV *& InvariantRHS)
  • public bool isMonotonicPredicate(const llvm::SCEVAddRecExpr * LHS, ICmpInst::Predicate Pred, bool & Increasing)
  • public bool isSCEVable(llvm::Type * Ty) const
  • public static SCEV::NoWrapFlags maskFlags(SCEV::NoWrapFlags Flags, int Mask)
  • public void print(llvm::raw_ostream & OS) const
  • public bool properlyDominates(const llvm::SCEV * S, const llvm::BasicBlock * BB)
  • public const llvm::SCEV * rewriteUsingPredicate(const llvm::SCEV * S, const llvm::Loop * L, llvm::SCEVUnionPredicate & A)
  • public static SCEV::NoWrapFlags setFlags(SCEV::NoWrapFlags Flags, SCEV::NoWrapFlags OnFlags)
  • public void verify() const
  • public ~ScalarEvolution()

Methods

uint32_t GetMinTrailingZeros(const llvm::SCEV* S)

Description

Determine the minimum number of zero bits that S is guaranteed to end in (at every loop iteration). It is, at the same time, the minimum number of times S is divisible by 2. For example, given {4,+,8} it returns 2. If S is guaranteed to be 0, it returns the bitwidth of S.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:813

Parameters

const llvm::SCEV* S

ScalarEvolution(llvm::Function& F,
                llvm::TargetLibraryInfo& TLI,
                llvm::AssumptionCache& AC,
                llvm::DominatorTree& DT,
                llvm::LoopInfo& LI)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:474

Parameters

llvm::Function& F
llvm::TargetLibraryInfo& TLI
llvm::AssumptionCache& AC
llvm::DominatorTree& DT
llvm::LoopInfo& LI

ScalarEvolution(llvm::ScalarEvolution&& Arg)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:476

Parameters

llvm::ScalarEvolution&& Arg

bool SimplifyICmpOperands(
    ICmpInst::Predicate& Pred,
    const llvm::SCEV*& LHS,
    const llvm::SCEV*& RHS,
    unsigned int Depth = 0)

Description

Simplify LHS and RHS in a comparison with predicate Pred. Return true iff any changes were made. If the operands are provably equal or unequal, LHS and RHS are set to the same value and Pred is set to either ICMP_EQ or ICMP_NE.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:938

Parameters

ICmpInst::Predicate& Pred
const llvm::SCEV*& LHS
const llvm::SCEV*& RHS
unsigned int Depth = 0

std::pair<const SCEV*, const SCEV*>
SplitIntoInitAndPostInc(const llvm::Loop* L,
                        const llvm::SCEV* S)

Description

Splits SCEV expression \p S into two SCEVs. One of them is obtained from\p S by substitution of all AddRec sub-expression related to loop \p L with initial value of that SCEV. The second is obtained from \p S by substitution of all AddRec sub-expressions related to loop \p L with post increment of this AddRec in the loop \p L. In both cases all other AddRec sub-expressions (not related to \p L) remain the same. If the \p S contains non-invariant unknown SCEV the function returns CouldNotCompute SCEV in both values of std::pair. For example, for SCEV S={0, +, 1} <L1 > + {0, +, 1} <L2 > and loop L=L1 the function returns pair: first = {0, +, 1} <L2 > second = {1, +, 1} <L1 > + {0, +, 1} <L2 > We can see that for the first AddRec sub-expression it was replaced with 0 (initial value) for the first element and to {1, +, 1} <L1 > (post increment value) for the second one. In both cases AddRec expression related to L2 remains the same.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:878

Parameters

const llvm::Loop* L
const llvm::SCEV* S

static SCEV::NoWrapFlags clearFlags(
    SCEV::NoWrapFlags Flags,
    SCEV::NoWrapFlags OffFlags)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:470

Parameters

SCEV::NoWrapFlags Flags
SCEV::NoWrapFlags OffFlags

void collectParametricTerms(
    const llvm::SCEV* Expr,
    SmallVectorImpl<const llvm::SCEV*>& Terms)

Description

Collect parametric terms occurring in step expressions (first step of delinearization).

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:992

Parameters

const llvm::SCEV* Expr
SmallVectorImpl<const llvm::SCEV*>& Terms

void computeAccessFunctions(
    const llvm::SCEV* Expr,
    SmallVectorImpl<const llvm::SCEV*>&
        Subscripts,
    SmallVectorImpl<const llvm::SCEV*>& Sizes)

Description

Return in Subscripts the access functions for each dimension in Sizes (third step of delinearization).

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:997

Parameters

const llvm::SCEV* Expr
SmallVectorImpl<const llvm::SCEV*>& Subscripts
SmallVectorImpl<const llvm::SCEV*>& Sizes

bool containsAddRecurrence(const llvm::SCEV* S)

Description

Return true if the SCEV is a scAddRecExpr or it contains scAddRecExpr. The result will be cached in HasRecMap.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:501

Parameters

const llvm::SCEV* S

const llvm::SCEVAddRecExpr*
convertSCEVToAddRecWithPredicates(
    const llvm::SCEV* S,
    const llvm::Loop* L,
    SmallPtrSetImpl<const llvm::SCEVPredicate*>&
        Preds)

Description

Tries to convert the \p S expression to an AddRec expression, adding additional predicates to \p Preds as required.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:1086

Parameters

const llvm::SCEV* S
const llvm::Loop* L
SmallPtrSetImpl<const llvm::SCEVPredicate*>& Preds

Optional<std::pair<
    const SCEV*,
    SmallVector<const SCEVPredicate*, 3>>>
createAddRecFromPHIWithCasts(
    const llvm::SCEVUnknown* SymbolicPHI)

Description

Checks if \p SymbolicPHI can be rewritten as an AddRecExpr under some Predicates. If successful return these <AddRecExpr , Predicates>; The function is intended to be called from PSCEV (the caller will decide whether to actually add the predicates and carry out the rewrites).

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:565

Parameters

const llvm::SCEVUnknown* SymbolicPHI

void delinearize(
    const llvm::SCEV* Expr,
    SmallVectorImpl<const llvm::SCEV*>&
        Subscripts,
    SmallVectorImpl<const llvm::SCEV*>& Sizes,
    const llvm::SCEV* ElementSize)

Description

Split this SCEVAddRecExpr into two vectors of SCEVs representing the subscripts and sizes of an array access. The delinearization is a 3 step process: the first two steps compute the sizes of each subscript and the third step computes the access functions for the delinearized array: 1. Find the terms in the step functions 2. Compute the array size 3. Compute the access function: divide the SCEV by the array size starting with the innermost dimensions found in step 2. The Quotient is the SCEV to be divided in the next step of the recursion. The Remainder is the subscript of the innermost dimension. Loop over all array dimensions computed in step 2. To compute a uniform array size for several memory accesses to the same object, one can collect in step 1 all the step terms for all the memory accesses, and compute in step 2 a unique array shape. This guarantees that the array shape will be the same across all memory accesses. FIXME: We could derive the result of steps 1 and 2 from a description of the array shape given in metadata. Example: A[][n][m] for i for j for k A[j+k][2i][5i] = The initial SCEV: A[{{{0,+,2*m+5}_i, +, n*m}_j, +, n*m}_k] 1. Find the different terms in the step functions: -> [2*m, 5, n*m, n*m] 2. Compute the array size: sort and unique them -> [n*m, 2*m, 5] find the GCD of all the terms = 1 divide by the GCD and erase constant terms -> [n*m, 2*m] GCD = m divide by GCD -> [n, 2] remove constant terms -> [n] size of the array is A[unknown][n][m] 3. Compute the access function a. Divide {{{0,+,2*m+5}_i, +, n*m}_j, +, n*m}_k by the innermost size m Quotient: {{{0,+,2}_i, +, n}_j, +, n}_k Remainder: {{{0,+,5}_i, +, 0}_j, +, 0}_k The remainder is the subscript of the innermost array dimension: [5i]. b. Divide Quotient: {{{0,+,2}_i, +, n}_j, +, n}_k by next outer size n Quotient: {{{0,+,0}_i, +, 1}_j, +, 1}_k Remainder: {{{0,+,2}_i, +, 0}_j, +, 0}_k The Remainder is the subscript of the next array dimension: [2i]. The subscript of the outermost dimension is the Quotient: [j+k]. Overall, we have: A[][n][m], and the access function: A[j+k][2i][5i].

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:1065

Parameters

const llvm::SCEV* Expr
SmallVectorImpl<const llvm::SCEV*>& Subscripts
SmallVectorImpl<const llvm::SCEV*>& Sizes
const llvm::SCEV* ElementSize

bool dominates(const llvm::SCEV* S,
               const llvm::BasicBlock* BB)

Description

Return true if elements that makes up the given SCEV dominate the specified basic block.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:966

Parameters

const llvm::SCEV* S
const llvm::BasicBlock* BB

void eraseValueFromMap(llvm::Value* V)

Description

Erase Value from ValueExprMap and ExprValueMap.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:504

Parameters

llvm::Value* V

void findArrayDimensions(
    SmallVectorImpl<const llvm::SCEV*>& Terms,
    SmallVectorImpl<const llvm::SCEV*>& Sizes,
    const llvm::SCEV* ElementSize)

Description

Compute the array dimensions Sizes from the set of Terms extracted from the memory access function of this SCEVAddRecExpr (second step of delinearization).

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:981

Parameters

SmallVectorImpl<const llvm::SCEV*>& Terms
SmallVectorImpl<const llvm::SCEV*>& Sizes
const llvm::SCEV* ElementSize

void forgetAllLoops()

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:783

void forgetLoop(const llvm::Loop* L)

Description

This method should be called by the client when it has changed a loop in a way that may effect ScalarEvolution's ability to compute a trip count, or if the loop is deleted. This call is potentially expensive for large loop bodies.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:789

Parameters

const llvm::Loop* L

void forgetLoopDispositions(const llvm::Loop* L)

Description

Called when the client has changed the disposition of values in this loop. We don't have a way to invalidate per-loop dispositions. Clear and recompute is simpler.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:807

Parameters

const llvm::Loop* L

void forgetTopmostLoop(const llvm::Loop* L)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:795

Parameters

const llvm::Loop* L

void forgetValue(llvm::Value* V)

Description

This method should be called by the client when it has changed a value in a way that may effect its value, or which may disconnect it from a def-use chain linking it to a loop.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:800

Parameters

llvm::Value* V

const llvm::SCEV* getAddExpr(
    SmallVectorImpl<const llvm::SCEV*>& Ops,
    SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap,
    unsigned int Depth = 0)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:517

Parameters

SmallVectorImpl<const llvm::SCEV*>& Ops
SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap
unsigned int Depth = 0

const llvm::SCEV* getAddExpr(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap,
    unsigned int Depth = 0)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:520

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS
SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap
unsigned int Depth = 0

const llvm::SCEV* getAddExpr(
    const llvm::SCEV* Op0,
    const llvm::SCEV* Op1,
    const llvm::SCEV* Op2,
    SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap,
    unsigned int Depth = 0)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:526

Parameters

const llvm::SCEV* Op0
const llvm::SCEV* Op1
const llvm::SCEV* Op2
SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap
unsigned int Depth = 0

const llvm::SCEV* getAddRecExpr(
    SmallVectorImpl<const llvm::SCEV*>& Operands,
    const llvm::Loop* L,
    SCEV::NoWrapFlags Flags)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:552

Parameters

SmallVectorImpl<const llvm::SCEV*>& Operands
const llvm::Loop* L
SCEV::NoWrapFlags Flags

const llvm::SCEV* getAddRecExpr(
    const llvm::SCEV* Start,
    const llvm::SCEV* Step,
    const llvm::Loop* L,
    SCEV::NoWrapFlags Flags)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:550

Parameters

const llvm::SCEV* Start
const llvm::SCEV* Step
const llvm::Loop* L
SCEV::NoWrapFlags Flags

const llvm::SCEV* getAddRecExpr(
    const SmallVectorImpl<const llvm::SCEV*>&
        Operands,
    const llvm::Loop* L,
    SCEV::NoWrapFlags Flags)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:554

Parameters

const SmallVectorImpl<const llvm::SCEV*>& Operands
const llvm::Loop* L
SCEV::NoWrapFlags Flags

const llvm::SCEV* getAnyExtendExpr(
    const llvm::SCEV* Op,
    llvm::Type* Ty)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:516

Parameters

const llvm::SCEV* Op
llvm::Type* Ty

const llvm::SCEV* getBackedgeTakenCount(
    const llvm::Loop* L,
    llvm::ScalarEvolution::ExitCountKind Kind =
        Exact)

Description

If the specified loop has a predictable backedge-taken count, return it, otherwise return a SCEVCouldNotCompute object. The backedge-taken count is the number of times the loop header will be branched to from within the loop, assuming there are no abnormal exists like exception throws. This is one less than the trip count of the loop, since it doesn't count the first iteration, when the header is branched to from outside the loop. Note that it is not valid to call this method on a loop without a loop-invariant backedge-taken count (see hasLoopInvariantBackedgeTakenCount).

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:753

Parameters

const llvm::Loop* L
llvm::ScalarEvolution::ExitCountKind Kind = Exact

llvm::ScalarEvolution::BlockDisposition
getBlockDisposition(const llvm::SCEV* S,
                    const llvm::BasicBlock* BB)

Description

Return the "disposition" of the given SCEV with respect to the given block.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:962

Parameters

const llvm::SCEV* S
const llvm::BasicBlock* BB

const llvm::SCEV* getConstant(
    llvm::Type* Ty,
    uint64_t V,
    bool isSigned = false)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:512

Parameters

llvm::Type* Ty
uint64_t V
bool isSigned = false

const llvm::SCEV* getConstant(
    const llvm::APInt& Val)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:511

Parameters

const llvm::APInt& Val

const llvm::SCEV* getConstant(
    llvm::ConstantInt* V)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:510

Parameters

llvm::ConstantInt* V

const llvm::SCEV*
getConstantMaxBackedgeTakenCount(
    const llvm::Loop* L)

Description

When successful, this returns a SCEVConstant that is greater than or equal to (i.e. a "conservative over-approximation") of the value returend by getBackedgeTakenCount. If such a value cannot be computed, it returns the SCEVCouldNotCompute object.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:766

Parameters

const llvm::Loop* L

llvm::LLVMContext& getContext() const

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:479

const llvm::SCEV* getCouldNotCompute()

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:585

const llvm::DataLayout& getDataLayout() const

Description

Return the DataLayout associated with the module this SCEV instance is operating on.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:1071

llvm::Type* getEffectiveSCEVType(
    llvm::Type* Ty) const

Description

Return a type with the same bitwidth as the given type and which represents how SCEV will treat the given type, for which isSCEVable must return true. For pointer types, this is the pointer-sized integer type.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:494

Parameters

llvm::Type* Ty

const llvm::SCEV* getElementSize(
    llvm::Instruction* Inst)

Description

Return the size of an element read or written by Inst.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:976

Parameters

llvm::Instruction* Inst

const llvm::SCEVPredicate* getEqualPredicate(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:1075

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS

const llvm::SCEV* getExitCount(
    const llvm::Loop* L,
    llvm::BasicBlock* ExitingBlock,
    llvm::ScalarEvolution::ExitCountKind Kind =
        Exact)

Description

Return the number of times the backedge executes before the given exit would be taken; if not exactly computable, return SCEVCouldNotCompute. For a single exit loop, this value is equivelent to the result of getBackedgeTakenCount. The loop is guaranteed to exit (via *some* exit) before the backedge is executed (ExitCount + 1) times. Note that there is no guarantee about *which* exit is taken on the exiting iteration.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:740

Parameters

const llvm::Loop* L
llvm::BasicBlock* ExitingBlock
llvm::ScalarEvolution::ExitCountKind Kind = Exact

const llvm::SCEV* getGEPExpr(
    llvm::GEPOperator* GEP,
    const SmallVectorImpl<const llvm::SCEV*>&
        IndexExprs)

Description

Returns an expression for a GEP \p GEP The GEP. The indices contained in the GEP itself are ignored, instead we use IndexExprs.\p IndexExprs The expressions for the indices.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:572

Parameters

llvm::GEPOperator* GEP
const SmallVectorImpl<const llvm::SCEV*>& IndexExprs

llvm::ScalarEvolution::LoopDisposition
getLoopDisposition(const llvm::SCEV* S,
                   const llvm::Loop* L)

Description

Return the "disposition" of the given SCEV with respect to the given loop.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:943

Parameters

const llvm::SCEV* S
const llvm::Loop* L

const llvm::SCEV* getMinMaxExpr(
    unsigned int Kind,
    SmallVectorImpl<const llvm::SCEV*>& Operands)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:574

Parameters

unsigned int Kind
SmallVectorImpl<const llvm::SCEV*>& Operands

const llvm::SCEV* getMinusSCEV(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap,
    unsigned int Depth = 0)

Description

Return LHS-RHS. Minus is represented in SCEV as A+B*-1.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:607

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS
SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap
unsigned int Depth = 0

const llvm::SCEV* getMulExpr(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap,
    unsigned int Depth = 0)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:535

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS
SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap
unsigned int Depth = 0

const llvm::SCEV* getMulExpr(
    const llvm::SCEV* Op0,
    const llvm::SCEV* Op1,
    const llvm::SCEV* Op2,
    SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap,
    unsigned int Depth = 0)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:541

Parameters

const llvm::SCEV* Op0
const llvm::SCEV* Op1
const llvm::SCEV* Op2
SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap
unsigned int Depth = 0

const llvm::SCEV* getMulExpr(
    SmallVectorImpl<const llvm::SCEV*>& Ops,
    SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap,
    unsigned int Depth = 0)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:532

Parameters

SmallVectorImpl<const llvm::SCEV*>& Ops
SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap
unsigned int Depth = 0

const llvm::SCEV* getNegativeSCEV(
    const llvm::SCEV* V,
    SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap)

Description

Return the SCEV object corresponding to -V.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:600

Parameters

const llvm::SCEV* V
SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap

const llvm::SCEV* getNoopOrAnyExtend(
    const llvm::SCEV* V,
    llvm::Type* Ty)

Description

Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is extended with unspecified bits. The conversion must not be narrowing.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:634

Parameters

const llvm::SCEV* V
llvm::Type* Ty

const llvm::SCEV* getNoopOrSignExtend(
    const llvm::SCEV* V,
    llvm::Type* Ty)

Description

Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is sign extended. The conversion must not be narrowing.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:629

Parameters

const llvm::SCEV* V
llvm::Type* Ty

const llvm::SCEV* getNoopOrZeroExtend(
    const llvm::SCEV* V,
    llvm::Type* Ty)

Description

Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is zero extended. The conversion must not be narrowing.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:624

Parameters

const llvm::SCEV* V
llvm::Type* Ty

const llvm::SCEV* getNotSCEV(const llvm::SCEV* V)

Description

Return the SCEV object corresponding to ~V.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:604

Parameters

const llvm::SCEV* V

const llvm::SCEV* getOffsetOfExpr(
    llvm::Type* IntTy,
    llvm::StructType* STy,
    unsigned int FieldNo)

Description

Return an expression for offsetof on the given field with type IntTy

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:597

Parameters

llvm::Type* IntTy
llvm::StructType* STy
unsigned int FieldNo

const llvm::SCEV* getOne(llvm::Type* Ty)

Description

Return a SCEV for the constant 1 of a specific type.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:591

Parameters

llvm::Type* Ty

const llvm::SCEV* getPointerBase(
    const llvm::SCEV* V)

Description

Transitively follow the chain of pointer-type operands until reaching a SCEV that does not have a single pointer operand. This returns a SCEVUnknown pointer for well-formed pointer-type expressions, but corner cases do exist.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:656

Parameters

const llvm::SCEV* V

const llvm::SCEV* getPredicatedBackedgeTakenCount(
    const llvm::Loop* L,
    llvm::SCEVUnionPredicate& Predicates)

Description

Similar to getBackedgeTakenCount, except it will add a set of SCEV predicates to Predicates that are required to be true in order for the answer to be correct. Predicates can be checked with run-time checks and can be used to perform loop versioning.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:759

Parameters

const llvm::Loop* L
llvm::SCEVUnionPredicate& Predicates

const llvm::SCEV* getSCEV(llvm::Value* V)

Description

Return a SCEV expression for the full generality of the specified expression.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:508

Parameters

llvm::Value* V

const llvm::SCEV* getSCEVAtScope(
    llvm::Value* V,
    const llvm::Loop* L)

Description

This is a convenience function which does getSCEVAtScope(getSCEV(V), L).

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:671

Parameters

llvm::Value* V
const llvm::Loop* L

const llvm::SCEV* getSCEVAtScope(
    const llvm::SCEV* S,
    const llvm::Loop* L)

Description

Return a SCEV expression for the specified value at the specified scope in the program. The L value specifies a loop nest to evaluate the expression at, where null is the top-level or a specified loop is immediately inside of the loop. This method can be used to compute the exit value for a variable defined in a loop by querying what the value will hold in the parent loop. In the case that a relevant loop exit value cannot be computed, the original value V is returned.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:668

Parameters

const llvm::SCEV* S
const llvm::Loop* L

const llvm::SCEV* getSMaxExpr(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:576

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS

const llvm::SCEV* getSMaxExpr(
    SmallVectorImpl<const llvm::SCEV*>& Operands)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:577

Parameters

SmallVectorImpl<const llvm::SCEV*>& Operands

const llvm::SCEV* getSMinExpr(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:580

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS

const llvm::SCEV* getSMinExpr(
    SmallVectorImpl<const llvm::SCEV*>& Operands)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:581

Parameters

SmallVectorImpl<const llvm::SCEV*>& Operands

const llvm::SCEV* getSignExtendExpr(
    const llvm::SCEV* Op,
    llvm::Type* Ty,
    unsigned int Depth = 0)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:515

Parameters

const llvm::SCEV* Op
llvm::Type* Ty
unsigned int Depth = 0

llvm::ConstantRange getSignedRange(
    const llvm::SCEV* S)

Description

Determine the signed range for a particular SCEV. NOTE: This returns a copy of the reference returned by getRangeRef.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:833

Parameters

const llvm::SCEV* S

llvm::APInt getSignedRangeMax(const llvm::SCEV* S)

Description

Determine the max of the signed range for a particular SCEV.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:843

Parameters

const llvm::SCEV* S

llvm::APInt getSignedRangeMin(const llvm::SCEV* S)

Description

Determine the min of the signed range for a particular SCEV.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:838

Parameters

const llvm::SCEV* S

const llvm::SCEV* getSizeOfExpr(
    llvm::Type* IntTy,
    llvm::Type* AllocTy)

Description

Return an expression for sizeof AllocTy that is type IntTy

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:594

Parameters

llvm::Type* IntTy
llvm::Type* AllocTy

unsigned int getSmallConstantMaxTripCount(
    const llvm::Loop* L)

Description

Returns the upper bound of the loop trip count as a normal unsigned value. Returns 0 if the trip count is unknown or not constant.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:703

Parameters

const llvm::Loop* L

unsigned int getSmallConstantTripCount(
    const llvm::Loop* L)

Description

Returns the maximum trip count of the loop if it is a single-exit loop and we can compute a small maximum for that loop. Implemented in terms of the \c getSmallConstantTripCount overload with the single exiting block passed to it. See that routine for details.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:689

Parameters

const llvm::Loop* L

unsigned int getSmallConstantTripCount(
    const llvm::Loop* L,
    llvm::BasicBlock* ExitingBlock)

Description

Returns the maximum trip count of this loop as a normal unsigned value. Returns 0 if the trip count is unknown or not constant. This "trip count" assumes that control exits via ExitingBlock. More precisely, it is the number of times that control may reach ExitingBlock before taking the branch. For loops with multiple exits, it may not be the number times that the loop header executes if the loop exits prematurely via another branch.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:698

Parameters

const llvm::Loop* L
llvm::BasicBlock* ExitingBlock

unsigned int getSmallConstantTripMultiple(
    const llvm::Loop* L)

Description

Returns the largest constant divisor of the trip count of the loop if it is a single-exit loop and we can compute a small maximum for that loop. Implemented in terms of the \c getSmallConstantTripMultiple overload with the single exiting block passed to it. See that routine for details.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:711

Parameters

const llvm::Loop* L

unsigned int getSmallConstantTripMultiple(
    const llvm::Loop* L,
    llvm::BasicBlock* ExitingBlock)

Description

Returns the largest constant divisor of the trip count of this loop as a normal unsigned value, if possible. This means that the actual trip count is always a multiple of the returned value (don't forget the trip count could very well be zero as well!). As explained in the comments for getSmallConstantTripCount, this assumes that control exits the loop via ExitingBlock.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:719

Parameters

const llvm::Loop* L
llvm::BasicBlock* ExitingBlock

const llvm::SCEV* getTruncateExpr(
    const llvm::SCEV* Op,
    llvm::Type* Ty,
    unsigned int Depth = 0)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:513

Parameters

const llvm::SCEV* Op
llvm::Type* Ty
unsigned int Depth = 0

const llvm::SCEV* getTruncateOrNoop(
    const llvm::SCEV* V,
    llvm::Type* Ty)

Description

Return a SCEV corresponding to a conversion of the input value to the specified type. The conversion must not be widening.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:638

Parameters

const llvm::SCEV* V
llvm::Type* Ty

const llvm::SCEV* getTruncateOrSignExtend(
    const llvm::SCEV* V,
    llvm::Type* Ty,
    unsigned int Depth = 0)

Description

Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is sign extended.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:618

Parameters

const llvm::SCEV* V
llvm::Type* Ty
unsigned int Depth = 0

const llvm::SCEV* getTruncateOrZeroExtend(
    const llvm::SCEV* V,
    llvm::Type* Ty,
    unsigned int Depth = 0)

Description

Return a SCEV corresponding to a conversion of the input value to the specified type. If the type must be extended, it is zero extended.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:613

Parameters

const llvm::SCEV* V
llvm::Type* Ty
unsigned int Depth = 0

uint64_t getTypeSizeInBits(llvm::Type* Ty) const

Description

Return the size in bits of the specified type, for which isSCEVable must return true.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:489

Parameters

llvm::Type* Ty

const llvm::SCEV* getUDivExactExpr(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:548

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS

const llvm::SCEV* getUDivExpr(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:547

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS

const llvm::SCEV* getUMaxExpr(
    SmallVectorImpl<const llvm::SCEV*>& Operands)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:579

Parameters

SmallVectorImpl<const llvm::SCEV*>& Operands

const llvm::SCEV* getUMaxExpr(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:578

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS

const llvm::SCEV* getUMaxFromMismatchedTypes(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Description

Promote the operands to the wider of the types using zero-extension, and then perform a umax operation with them.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:642

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS

const llvm::SCEV* getUMinExpr(
    SmallVectorImpl<const llvm::SCEV*>& Operands)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:583

Parameters

SmallVectorImpl<const llvm::SCEV*>& Operands

const llvm::SCEV* getUMinExpr(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:582

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS

const llvm::SCEV* getUMinFromMismatchedTypes(
    SmallVectorImpl<const llvm::SCEV*>& Ops)

Description

Promote the operands to the wider of the types using zero-extension, and then perform a umin operation with them. N-ary function.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:650

Parameters

SmallVectorImpl<const llvm::SCEV*>& Ops

const llvm::SCEV* getUMinFromMismatchedTypes(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Description

Promote the operands to the wider of the types using zero-extension, and then perform a umin operation with them.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:646

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS

const llvm::SCEV* getURemExpr(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:549

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS

const llvm::SCEV* getUnknown(llvm::Value* V)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:584

Parameters

llvm::Value* V

llvm::ConstantRange getUnsignedRange(
    const llvm::SCEV* S)

Description

Determine the unsigned range for a particular SCEV. NOTE: This returns a copy of the reference returned by getRangeRef.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:817

Parameters

const llvm::SCEV* S

llvm::APInt getUnsignedRangeMax(
    const llvm::SCEV* S)

Description

Determine the max of the unsigned range for a particular SCEV.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:827

Parameters

const llvm::SCEV* S

llvm::APInt getUnsignedRangeMin(
    const llvm::SCEV* S)

Description

Determine the min of the unsigned range for a particular SCEV.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:822

Parameters

const llvm::SCEV* S

llvm::Type* getWiderType(llvm::Type* Ty1,
                         llvm::Type* Ty2) const

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:497

Parameters

llvm::Type* Ty1
llvm::Type* Ty2

const llvm::SCEVPredicate* getWrapPredicate(
    const llvm::SCEVAddRecExpr* AR,
    SCEVWrapPredicate::IncrementWrapFlags
        AddedFlags)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:1078

Parameters

const llvm::SCEVAddRecExpr* AR
SCEVWrapPredicate::IncrementWrapFlags AddedFlags

const llvm::SCEV* getZero(llvm::Type* Ty)

Description

Return a SCEV for the constant 0 of a specific type.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:588

Parameters

llvm::Type* Ty

const llvm::SCEV* getZeroExtendExpr(
    const llvm::SCEV* Op,
    llvm::Type* Ty,
    unsigned int Depth = 0)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:514

Parameters

const llvm::SCEV* Op
llvm::Type* Ty
unsigned int Depth = 0

bool hasComputableLoopEvolution(
    const llvm::SCEV* S,
    const llvm::Loop* L)

Description

Return true if the given SCEV changes value in a known way in the specified loop. This property being true implies that the value is variant in the loop AND that we can emit an expression to compute the value of the expression at any particular loop iteration.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:958

Parameters

const llvm::SCEV* S
const llvm::Loop* L

bool hasLoopInvariantBackedgeTakenCount(
    const llvm::Loop* L)

Description

Return true if the specified loop has an analyzable loop-invariant backedge-taken count.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:776

Parameters

const llvm::Loop* L

bool hasOperand(const llvm::SCEV* S,
                const llvm::SCEV* Op) const

Description

Test whether the given SCEV has Op as a direct or indirect operand.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:973

Parameters

const llvm::SCEV* S
const llvm::SCEV* Op

bool invalidate(
    llvm::Function& F,
    const llvm::PreservedAnalyses& PA,
    FunctionAnalysisManager::Invalidator& Inv)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:987

Parameters

llvm::Function& F
const llvm::PreservedAnalyses& PA
FunctionAnalysisManager::Invalidator& Inv

bool isAvailableAtLoopEntry(const llvm::SCEV* S,
                            const llvm::Loop* L)

Description

Determine if the SCEV can be evaluated at loop's entry. It is true if it doesn't depend on a SCEVUnknown of an instruction which is dominated by the header of loop L.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:952

Parameters

const llvm::SCEV* S
const llvm::Loop* L

bool isBackedgeTakenCountMaxOrZero(
    const llvm::Loop* L)

Description

Return true if the backedge taken count is either the value returned by getConstantMaxBackedgeTakenCount or zero.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:772

Parameters

const llvm::Loop* L

bool isKnownNegative(const llvm::SCEV* S)

Description

Test if the given expression is known to be negative.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:848

Parameters

const llvm::SCEV* S

bool isKnownNonNegative(const llvm::SCEV* S)

Description

Test if the given expression is known to be non-negative.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:854

Parameters

const llvm::SCEV* S

bool isKnownNonPositive(const llvm::SCEV* S)

Description

Test if the given expression is known to be non-positive.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:857

Parameters

const llvm::SCEV* S

bool isKnownNonZero(const llvm::SCEV* S)

Description

Test if the given expression is known to be non-zero.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:860

Parameters

const llvm::SCEV* S

bool isKnownOnEveryIteration(
    ICmpInst::Predicate Pred,
    const llvm::SCEVAddRecExpr* LHS,
    const llvm::SCEV* RHS)

Description

Test if the condition described by Pred, LHS, RHS is known to be true on every iteration of the loop of the recurrency LHS.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:909

Parameters

ICmpInst::Predicate Pred
const llvm::SCEVAddRecExpr* LHS
const llvm::SCEV* RHS

bool isKnownPositive(const llvm::SCEV* S)

Description

Test if the given expression is known to be positive.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:851

Parameters

const llvm::SCEV* S

bool isKnownPredicate(ICmpInst::Predicate Pred,
                      const llvm::SCEV* LHS,
                      const llvm::SCEV* RHS)

Description

Test if the given expression is known to satisfy the condition described by Pred, LHS, and RHS.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:904

Parameters

ICmpInst::Predicate Pred
const llvm::SCEV* LHS
const llvm::SCEV* RHS

bool isKnownViaInduction(ICmpInst::Predicate Pred,
                         const llvm::SCEV* LHS,
                         const llvm::SCEV* RHS)

Description

We'd like to check the predicate on every iteration of the most dominated loop between loops used in LHS and RHS. To do this we use the following list of steps: 1. Collect set S all loops on which either LHS or RHS depend. 2. If S is non-empty a. Let PD be the element of S which is dominated by all other elements. b. Let E(LHS) be value of LHS on entry of PD. To get E(LHS), we should just take LHS and replace all AddRecs that are attached to PD on with their entry values. Define E(RHS) in the same way. c. Let B(LHS) be value of L on backedge of PD. To get B(LHS), we should just take LHS and replace all AddRecs that are attached to PD on with their backedge values. Define B(RHS) in the same way. d. Note that E(LHS) and E(RHS) are automatically available on entry of PD, so we can assert on that. e. Return true if isLoopEntryGuardedByCond(Pred, E(LHS), E(RHS)) & & isLoopBackedgeGuardedByCond(Pred, B(LHS), B(RHS))

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:899

Parameters

ICmpInst::Predicate Pred
const llvm::SCEV* LHS
const llvm::SCEV* RHS

bool isLoopBackedgeGuardedByCond(
    const llvm::Loop* L,
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Description

Test whether the backedge of the loop is protected by a conditional between LHS and RHS. This is used to eliminate casts.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:681

Parameters

const llvm::Loop* L
ICmpInst::Predicate Pred
const llvm::SCEV* LHS
const llvm::SCEV* RHS

bool isLoopEntryGuardedByCond(
    const llvm::Loop* L,
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Description

Test whether entry to the loop is protected by a conditional between LHS and RHS. This is used to help avoid max expressions in loop trip counts, and to eliminate casts.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:676

Parameters

const llvm::Loop* L
ICmpInst::Predicate Pred
const llvm::SCEV* LHS
const llvm::SCEV* RHS

bool isLoopInvariant(const llvm::SCEV* S,
                     const llvm::Loop* L)

Description

Return true if the value of the given SCEV is unchanging in the specified loop.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:947

Parameters

const llvm::SCEV* S
const llvm::Loop* L

bool isLoopInvariantPredicate(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::Loop* L,
    ICmpInst::Predicate& InvariantPred,
    const llvm::SCEV*& InvariantLHS,
    const llvm::SCEV*& InvariantRHS)

Description

Return true if the result of the predicate LHS `Pred` RHS is loop invariant with respect to L. Set InvariantPred, InvariantLHS and InvariantLHS so that InvariantLHS `InvariantPred` InvariantRHS is the loop invariant form of LHS `Pred` RHS.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:928

Parameters

ICmpInst::Predicate Pred
const llvm::SCEV* LHS
const llvm::SCEV* RHS
const llvm::Loop* L
ICmpInst::Predicate& InvariantPred
const llvm::SCEV*& InvariantLHS
const llvm::SCEV*& InvariantRHS

bool isMonotonicPredicate(
    const llvm::SCEVAddRecExpr* LHS,
    ICmpInst::Predicate Pred,
    bool& Increasing)

Description

Return true if, for all loop invariant X, the predicate "LHS `Pred` X" is monotonically increasing or decreasing. In the former case set `Increasing` to true and in the latter case set `Increasing` to false. A predicate is said to be monotonically increasing if may go from being false to being true as the loop iterates, but never the other way around. A predicate is said to be monotonically decreasing if may go from being true to being false as the loop iterates, but never the other way around.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:921

Parameters

const llvm::SCEVAddRecExpr* LHS
ICmpInst::Predicate Pred
bool& Increasing

bool isSCEVable(llvm::Type* Ty) const

Description

Test if values of the given type are analyzable within the SCEV framework. This primarily includes integer types, and it can optionally include pointer types if the ScalarEvolution class has access to target-specific information.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:485

Parameters

llvm::Type* Ty

static SCEV::NoWrapFlags maskFlags(
    SCEV::NoWrapFlags Flags,
    int Mask)

Description

Convenient NoWrapFlags manipulation that hides enum casts and is visible in the ScalarEvolution name space.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:461

Parameters

SCEV::NoWrapFlags Flags
int Mask

void print(llvm::raw_ostream& OS) const

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:985

Parameters

llvm::raw_ostream& OS

bool properlyDominates(const llvm::SCEV* S,
                       const llvm::BasicBlock* BB)

Description

Return true if elements that makes up the given SCEV properly dominate the specified basic block.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:970

Parameters

const llvm::SCEV* S
const llvm::BasicBlock* BB

const llvm::SCEV* rewriteUsingPredicate(
    const llvm::SCEV* S,
    const llvm::Loop* L,
    llvm::SCEVUnionPredicate& A)

Description

Re-writes the SCEV according to the Predicates in \p A.

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:1082

Parameters

const llvm::SCEV* S
const llvm::Loop* L
llvm::SCEVUnionPredicate& A

static SCEV::NoWrapFlags setFlags(
    SCEV::NoWrapFlags Flags,
    SCEV::NoWrapFlags OnFlags)

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:465

Parameters

SCEV::NoWrapFlags Flags
SCEV::NoWrapFlags OnFlags

void verify() const

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:986

~ScalarEvolution()

Declared at: llvm/include/llvm/Analysis/ScalarEvolution.h:477