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:449

Member Variables

private llvm::Function& F
The function we are analyzing.
private bool HasGuards
Does the module have any calls to the llvm.experimental.guard intrinsic at all? If this is false, we avoid doing work that will only help if thare are guards present in the IR.
private llvm::TargetLibraryInfo& TLI
The target library information for the target we are targeting.
private llvm::AssumptionCache& AC
The tracker for @ llvm.assume intrinsics in this function.
private llvm::DominatorTree& DT
The dominator tree.
private llvm::LoopInfo& LI
The loop information for the function we are currently analyzing.
private std::unique_ptr<SCEVCouldNotCompute> CouldNotCompute
This SCEV is used to represent unknown trip counts and things.
private llvm::ScalarEvolution::HasRecMapType HasRecMap
This is a cache to record whether a SCEV contains any scAddRecExpr.
private llvm::ScalarEvolution::ExprValueMapType ExprValueMap
ExprValueMap -- This map records the original values from which the SCEV expr is generated from.
private llvm::ScalarEvolution::ValueExprMapType ValueExprMap
This is a cache of the values we have analyzed so far.
private SmallPtrSet<const llvm::Value*, 6> PendingLoopPredicates
Mark predicate values currently being processed by isImpliedCond.
private SmallPtrSet<const llvm::PHINode*, 6> PendingPhiRanges
Mark SCEVUnknown Phis currently being processed by getRangeRef.
private SmallPtrSet<const llvm::PHINode*, 6> PendingMerges
private bool WalkingBEDominatingConds = false
Set to true by isLoopBackedgeGuardedByCond when we're walking the set of conditions dominating the backedge of a loop.
private bool ProvingSplitPredicate = false
Set to true by isKnownPredicateViaSplitting when we're trying to prove a predicate by splitting it into a set of independent predicates.
private DenseMap<const llvm::SCEV*, uint32_t> MinTrailingZerosCache
Memoized values for the GetMinTrailingZeros
private DenseMap<const llvm::Loop*, llvm::ScalarEvolution::BackedgeTakenInfo> BackedgeTakenCounts
Cache the backedge-taken count of the loops for this function as they are computed.
private DenseMap<const llvm::Loop*, llvm::ScalarEvolution::BackedgeTakenInfo> PredicatedBackedgeTakenCounts
Cache the predicated backedge-taken count of the loops for this function as they are computed.
private DenseMap< const llvm::SCEV*, SmallPtrSet<PointerIntPair<const llvm::Loop*, 1, bool>, 4>> BECountUsers
Loops whose backedge taken counts directly use this non-constant SCEV.
private DenseMap<llvm::PHINode*, llvm::Constant*> ConstantEvolutionLoopExitValue
This map contains entries for all of the PHI instructions that we attempt to compute constant evolutions for. This allows us to avoid potentially expensive recomputation of these properties. An instruction maps to null if we are unable to compute its exit value.
private DenseMap<const llvm::SCEV*, SmallVector< std::pair<const Loop*, const SCEV*>, 2>> ValuesAtScopes
This map contains entries for all the expressions that we attempt to compute getSCEVAtScope information for, which can be expensive in extreme cases.
private DenseMap<const llvm::SCEV*, SmallVector< std::pair<const Loop*, const SCEV*>, 2>> ValuesAtScopesUsers
Reverse map for invalidation purposes: Stores of which SCEV and which loop this is the value-at-scope of.
private DenseMap<const llvm::SCEV*, SmallVector<PointerIntPair< const llvm::Loop*, 2, llvm::ScalarEvolution:: LoopDisposition>, 2>> LoopDispositions
Memoized computeLoopDisposition results.
private DenseMap<const llvm::Loop*, llvm::ScalarEvolution::LoopProperties> LoopPropertiesCache
Cache for \c getLoopProperties.
private DenseMap<const llvm::SCEV*, SmallVector<PointerIntPair< const llvm::BasicBlock*, 2, llvm::ScalarEvolution:: BlockDisposition>, 2>> BlockDispositions
Memoized computeBlockDisposition results.
private DenseMap<const llvm::SCEV*, SmallPtrSet<const llvm::SCEV*, 8>> SCEVUsers
Stores all SCEV that use a given SCEV as its direct operand.
private DenseMap<const llvm::SCEV*, llvm::ConstantRange> UnsignedRanges
Memoized results from getRange
private DenseMap<const llvm::SCEV*, llvm::ConstantRange> SignedRanges
Memoized results from getRange
private FoldingSet<llvm::SCEV> UniqueSCEVs
private FoldingSet<llvm::SCEVPredicate> UniquePreds
private llvm::BumpPtrAllocator SCEVAllocator
private DenseMap< const llvm::Loop*, SmallVector<const llvm::SCEVAddRecExpr*, 4>> LoopUsers
This maps loops to a list of addrecs that directly use said loop.
private DenseMap< std::pair<const SCEVUnknown*, const Loop*>, std::pair< const SCEV*, SmallVector<const SCEVPredicate*, 3>>> PredicatedSCEVRewrites
Cache tentative mappings from UnknownSCEVs in a Loop, to a SCEV expression they can be rewritten into under certain predicates.
private llvm::SCEVUnknown* FirstUnknown = nullptr
The head of a linked list of all SCEVUnknown values that have been allocated. This is used by releaseMemory to locate them all and call their destructors.

Method Overview

  • public uint32_t GetMinTrailingZeros(const llvm::SCEV * S)
  • private uint32_t GetMinTrailingZerosImpl(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, bool ControllingFiniteLoop = false)
  • public std::pair<const SCEV *, const SCEV *> SplitIntoInitAndPostInc(const llvm::Loop * L, const llvm::SCEV * S)
  • public const llvm::SCEV * applyLoopGuards(const llvm::SCEV * Expr, const llvm::Loop * L)
  • private bool canIVOverflowOnGT(const llvm::SCEV * RHS, const llvm::SCEV * Stride, bool IsSigned)
  • private bool canIVOverflowOnLT(const llvm::SCEV * RHS, const llvm::SCEV * Stride, bool IsSigned)
  • private bool checkValidity(const llvm::SCEV * S) const
  • public static SCEV::NoWrapFlags clearFlags(SCEV::NoWrapFlags Flags, SCEV::NoWrapFlags OffFlags)
  • private llvm::ScalarEvolution::BackedgeTakenInfo computeBackedgeTakenCount(const llvm::Loop * L, bool AllowPredicates = false)
  • private llvm::ScalarEvolution::BlockDisposition computeBlockDisposition(const llvm::SCEV * S, const llvm::BasicBlock * BB)
  • public Optional<llvm::APInt> computeConstantDifference(const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • private const llvm::SCEV * computeExitCountExhaustively(const llvm::Loop * L, llvm::Value * Cond, bool ExitWhen)
  • private llvm::ScalarEvolution::ExitLimit computeExitLimit(const llvm::Loop * L, llvm::BasicBlock * ExitingBlock, bool AllowPredicates = false)
  • private llvm::ScalarEvolution::ExitLimit computeExitLimitFromCond(const llvm::Loop * L, llvm::Value * ExitCond, bool ExitIfTrue, bool ControlsExit, bool AllowPredicates = false)
  • private llvm::ScalarEvolution::ExitLimit computeExitLimitFromCondCached(llvm::ScalarEvolution::ExitLimitCacheTy & Cache, const llvm::Loop * L, llvm::Value * ExitCond, bool ExitIfTrue, bool ControlsExit, bool AllowPredicates)
  • private Optional<ScalarEvolution::ExitLimit> computeExitLimitFromCondFromBinOp(llvm::ScalarEvolution::ExitLimitCacheTy & Cache, const llvm::Loop * L, llvm::Value * ExitCond, bool ExitIfTrue, bool ControlsExit, bool AllowPredicates)
  • private llvm::ScalarEvolution::ExitLimit computeExitLimitFromCondImpl(llvm::ScalarEvolution::ExitLimitCacheTy & Cache, const llvm::Loop * L, llvm::Value * ExitCond, bool ExitIfTrue, bool ControlsExit, bool AllowPredicates)
  • private llvm::ScalarEvolution::ExitLimit computeExitLimitFromICmp(const llvm::Loop * L, llvm::ICmpInst * ExitCond, bool ExitIfTrue, bool IsSubExpr, bool AllowPredicates = false)
  • private llvm::ScalarEvolution::ExitLimit computeExitLimitFromICmp(const llvm::Loop * L, ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, bool IsSubExpr, bool AllowPredicates = false)
  • private llvm::ScalarEvolution::ExitLimit computeExitLimitFromSingleExitSwitch(const llvm::Loop * L, llvm::SwitchInst * Switch, llvm::BasicBlock * ExitingBB, bool IsSubExpr)
  • private llvm::ScalarEvolution::LoopDisposition computeLoopDisposition(const llvm::SCEV * S, const llvm::Loop * L)
  • private const llvm::SCEV * computeMaxBECountForLT(const llvm::SCEV * Start, const llvm::SCEV * Stride, const llvm::SCEV * End, unsigned int BitWidth, bool IsSigned)
  • private const llvm::SCEV * computeSCEVAtScope(const llvm::SCEV * S, const llvm::Loop * L)
  • private llvm::ScalarEvolution::ExitLimit computeShiftCompareExitLimit(llvm::Value * LHS, llvm::Value * RHS, const llvm::Loop * L, ICmpInst::Predicate Pred)
  • private const llvm::SCEV * computeSymbolicMaxBackedgeTakenCount(const llvm::Loop * L)
  • public bool containsAddRecurrence(const llvm::SCEV * S)
  • public bool containsErasedValue(const llvm::SCEV * S) const
  • public bool containsUndefs(const llvm::SCEV * S) const
  • public const llvm::SCEVAddRecExpr * convertSCEVToAddRecWithPredicates(const llvm::SCEV * S, const llvm::Loop * L, SmallPtrSetImpl<const llvm::SCEVPredicate *> & Preds)
  • private const llvm::SCEV * createAddRecFromPHI(llvm::PHINode * PN)
  • public Optional<std::pair<const SCEV *, SmallVector<const SCEVPredicate *, 3>>> createAddRecFromPHIWithCasts(const llvm::SCEVUnknown * SymbolicPHI)
  • private Optional<std::pair<const SCEV *, SmallVector<const SCEVPredicate *, 3>>> createAddRecFromPHIWithCastsImpl(const llvm::SCEVUnknown * SymbolicPHI)
  • private const llvm::SCEV * createNodeForGEP(llvm::GEPOperator * GEP)
  • private const llvm::SCEV * createNodeForPHI(llvm::PHINode * PN)
  • private const llvm::SCEV * createNodeForSelectOrPHI(llvm::Value * V, llvm::Value * Cond, llvm::Value * TrueVal, llvm::Value * FalseVal)
  • private const llvm::SCEV * createNodeForSelectOrPHIInstWithICmpInstCond(llvm::Instruction * I, llvm::ICmpInst * Cond, llvm::Value * TrueVal, llvm::Value * FalseVal)
  • private const llvm::SCEV * createNodeForSelectOrPHIViaUMinSeq(llvm::Value * I, llvm::Value * Cond, llvm::Value * TrueVal, llvm::Value * FalseVal)
  • private const llvm::SCEV * createNodeFromSelectLikePHI(llvm::PHINode * PN)
  • private const llvm::SCEV * createSCEV(llvm::Value * V)
  • private const llvm::SCEV * createSCEVIter(llvm::Value * V)
  • private const llvm::SCEV * createSimpleAffineAddRec(llvm::PHINode * PN, llvm::Value * BEValueV, llvm::Value * StartValueV)
  • public bool dominates(const llvm::SCEV * S, const llvm::BasicBlock * BB)
  • private void eraseValueFromMap(llvm::Value * V)
  • public Optional<bool> evaluatePredicate(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public Optional<bool> evaluatePredicateAt(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::Instruction * CtxI)
  • private llvm::SCEV * findExistingSCEVInCache(llvm::SCEVTypes SCEVType, ArrayRef<const llvm::SCEV *> Ops)
  • public void forgetAllLoops()
  • private void forgetBackedgeTakenCounts(const llvm::Loop * L, bool Predicated)
  • public void forgetLoop(const llvm::Loop * L)
  • public void forgetLoopDispositions(const llvm::Loop * L)
  • private void forgetMemoizedResults(ArrayRef<const llvm::SCEV *> SCEVs)
  • private void forgetMemoizedResultsImpl(const llvm::SCEV * S)
  • public void forgetTopmostLoop(const llvm::Loop * L)
  • public void forgetValue(llvm::Value * V)
  • public const llvm::SCEV * getAbsExpr(const llvm::SCEV * Op, bool IsNSW)
  • 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 * getAddExpr(const llvm::SCEV * LHS, const llvm::SCEV * RHS, SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap, unsigned int Depth = 0)
  • public const llvm::SCEV * getAddExpr(SmallVectorImpl<const llvm::SCEV *> & Ops, SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap, unsigned int Depth = 0)
  • public const llvm::SCEV * getAddRecExpr(const SmallVectorImpl<const llvm::SCEV *> & Operands, const llvm::Loop * L, SCEV::NoWrapFlags Flags)
  • 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 * getAnyExtendExpr(const llvm::SCEV * Op, llvm::Type * Ty)
  • public const llvm::SCEV * getBackedgeTakenCount(const llvm::Loop * L, llvm::ScalarEvolution::ExitCountKind Kind = Exact)
  • private llvm::ScalarEvolution::BackedgeTakenInfo & getBackedgeTakenInfo(const llvm::Loop * L)
  • public llvm::ScalarEvolution::BlockDisposition getBlockDisposition(const llvm::SCEV * S, const llvm::BasicBlock * BB)
  • public const llvm::SCEV * getCastExpr(llvm::SCEVTypes Kind, const llvm::SCEV * Op, llvm::Type * Ty)
  • public const llvm::SCEVPredicate * getComparePredicate(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • public const llvm::SCEV * getConstant(const llvm::APInt & Val)
  • public const llvm::SCEV * getConstant(llvm::Type * Ty, uint64_t V, bool isSigned = false)
  • public const llvm::SCEV * getConstant(llvm::ConstantInt * V)
  • private llvm::Constant * getConstantEvolutionLoopExitValue(llvm::PHINode * PN, const llvm::APInt & BEs, const llvm::Loop * L)
  • public const llvm::SCEV * getConstantMaxBackedgeTakenCount(const llvm::Loop * L)
  • public const llvm::SCEV * getConstantMaxTripCountFromArray(const llvm::Loop * L)
  • public llvm::LLVMContext & getContext() const
  • public const llvm::SCEV * getCouldNotCompute()
  • public const llvm::DataLayout & getDataLayout() const
  • private const llvm::Instruction * getDefiningScopeBound(ArrayRef<const llvm::SCEV *> Ops)
  • private const llvm::Instruction * getDefiningScopeBound(ArrayRef<const llvm::SCEV *> Ops, bool & Precise)
  • 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)
  • private const llvm::SCEV * getExistingSCEV(llvm::Value * V)
  • public const llvm::SCEV * getExitCount(const llvm::Loop * L, const 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 Optional<llvm::ScalarEvolution::LoopInvariantPredicate> getLoopInvariantExitCondDuringFirstIterations(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::Loop * L, const llvm::Instruction * CtxI, const llvm::SCEV * MaxIter)
  • public Optional<llvm::ScalarEvolution::LoopInvariantPredicate> getLoopInvariantPredicate(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::Loop * L)
  • private llvm::ScalarEvolution::LoopProperties getLoopProperties(const llvm::Loop * L)
  • public const llvm::SCEV * getLosslessPtrToIntExpr(const llvm::SCEV * Op, unsigned int Depth = 0)
  • public const llvm::SCEV * getMinMaxExpr(llvm::SCEVTypes Kind, SmallVectorImpl<const llvm::SCEV *> & Operands)
  • public const llvm::SCEV * getMinusOne(llvm::Type * Ty)
  • public const llvm::SCEV * getMinusSCEV(const llvm::SCEV * LHS, const llvm::SCEV * RHS, SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap, unsigned int Depth = 0)
  • public Optional<llvm::ScalarEvolution::MonotonicPredicateType> getMonotonicPredicateType(const llvm::SCEVAddRecExpr * LHS, ICmpInst::Predicate Pred)
  • private Optional<llvm::ScalarEvolution::MonotonicPredicateType> getMonotonicPredicateTypeImpl(const llvm::SCEVAddRecExpr * LHS, ICmpInst::Predicate Pred)
  • public const llvm::SCEV * getMulExpr(SmallVectorImpl<const llvm::SCEV *> & Ops, 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 * getNegativeSCEV(const llvm::SCEV * V, SCEV::NoWrapFlags Flags = SCEV::FlagAnyWrap)
  • private SCEV::NoWrapFlags getNoWrapFlagsFromUB(const llvm::Value * V)
  • private const llvm::Instruction * getNonTrivialDefiningScopeBound(const llvm::SCEV * S)
  • 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)
  • private const llvm::SCEV * getOperandsToCreate(llvm::Value * V, SmallVectorImpl<llvm::Value *> & Ops)
  • private const llvm::SCEV * getOrCreateAddExpr(ArrayRef<const llvm::SCEV *> Ops, SCEV::NoWrapFlags Flags)
  • private const llvm::SCEV * getOrCreateAddRecExpr(ArrayRef<const llvm::SCEV *> Ops, const llvm::Loop * L, SCEV::NoWrapFlags Flags)
  • private const llvm::SCEV * getOrCreateMulExpr(ArrayRef<const llvm::SCEV *> Ops, SCEV::NoWrapFlags Flags)
  • public const llvm::SCEV * getPointerBase(const llvm::SCEV * V)
  • private std::pair<const BasicBlock *, const BasicBlock *> getPredecessorWithUniqueSuccessorForBB(const llvm::BasicBlock * BB) const
  • public const llvm::SCEV * getPredicatedBackedgeTakenCount(const llvm::Loop * L, SmallVector<const llvm::SCEVPredicate *, 4> & Predicates)
  • private const llvm::ScalarEvolution::BackedgeTakenInfo & getPredicatedBackedgeTakenInfo(const llvm::Loop * L)
  • public const llvm::SCEV * getPtrToIntExpr(const llvm::SCEV * Op, llvm::Type * Ty)
  • private llvm::ConstantRange getRangeForAffineAR(const llvm::SCEV * Start, const llvm::SCEV * Step, const llvm::SCEV * MaxBECount, unsigned int BitWidth)
  • private llvm::ConstantRange getRangeForAffineNoSelfWrappingAR(const llvm::SCEVAddRecExpr * AddRec, const llvm::SCEV * MaxBECount, unsigned int BitWidth, llvm::ScalarEvolution::RangeSignHint SignHint)
  • private llvm::ConstantRange getRangeForUnknownRecurrence(const llvm::SCEVUnknown * U)
  • private const llvm::ConstantRange & getRangeRef(const llvm::SCEV * S, llvm::ScalarEvolution::RangeSignHint Hint)
  • private llvm::ConstantRange getRangeViaFactoring(const llvm::SCEV * Start, const llvm::SCEV * Step, const llvm::SCEV * MaxBECount, unsigned int BitWidth)
  • private void getReachableBlocks(SmallPtrSetImpl<llvm::BasicBlock *> & Reachable, llvm::Function & F)
  • 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)
  • private ArrayRef<llvm::Value *> getSCEVValues(const llvm::SCEV * S)
  • 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 * getSequentialMinMaxExpr(llvm::SCEVTypes Kind, 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 const llvm::SCEV * getSizeOfScalableVectorExpr(llvm::Type * IntTy, llvm::ScalableVectorType * ScalableTy)
  • public unsigned int getSmallConstantMaxTripCount(const llvm::Loop * L)
  • public unsigned int getSmallConstantTripCount(const llvm::Loop * L)
  • public unsigned int getSmallConstantTripCount(const llvm::Loop * L, const llvm::BasicBlock * ExitingBlock)
  • public unsigned int getSmallConstantTripMultiple(const llvm::Loop * L)
  • public unsigned int getSmallConstantTripMultiple(const llvm::Loop * L, const llvm::SCEV * ExitCount)
  • public unsigned int getSmallConstantTripMultiple(const llvm::Loop * L, const llvm::BasicBlock * ExitingBlock)
  • public const llvm::SCEV * getStoreSizeOfExpr(llvm::Type * IntTy, llvm::Type * StoreTy)
  • public Optional<SCEV::NoWrapFlags> getStrengthenedNoWrapFlagsFromBinOp(const llvm::OverflowingBinaryOperator * OBO)
  • public const llvm::SCEV * getSymbolicMaxBackedgeTakenCount(const llvm::Loop * L)
  • public const llvm::SCEV * getTripCountFromExitCount(const llvm::SCEV * ExitCount, bool Extend = true)
  • 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 * getUDivCeilSCEV(const llvm::SCEV * N, const llvm::SCEV * D)
  • 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, bool Sequential = false)
  • public const llvm::SCEV * getUMinExpr(const llvm::SCEV * LHS, const llvm::SCEV * RHS, bool Sequential = false)
  • public const llvm::SCEV * getUMinFromMismatchedTypes(const llvm::SCEV * LHS, const llvm::SCEV * RHS, bool Sequential = false)
  • public const llvm::SCEV * getUMinFromMismatchedTypes(SmallVectorImpl<const llvm::SCEV *> & Ops, bool Sequential = false)
  • 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)
  • private void getUsedLoops(const llvm::SCEV * S, SmallPtrSetImpl<const llvm::Loop *> & LoopsUsed)
  • 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 static bool hasFlags(SCEV::NoWrapFlags Flags, SCEV::NoWrapFlags TestFlags)
  • public bool hasLoopInvariantBackedgeTakenCount(const llvm::Loop * L)
  • public bool hasOperand(const llvm::SCEV * S, const llvm::SCEV * Op) const
  • private llvm::ScalarEvolution::ExitLimit howFarToNonZero(const llvm::SCEV * V, const llvm::Loop * L)
  • private llvm::ScalarEvolution::ExitLimit howFarToZero(const llvm::SCEV * V, const llvm::Loop * L, bool IsSubExpr, bool AllowPredicates = false)
  • private llvm::ScalarEvolution::ExitLimit howManyGreaterThans(const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::Loop * L, bool isSigned, bool IsSubExpr, bool AllowPredicates = false)
  • private llvm::ScalarEvolution::ExitLimit howManyLessThans(const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::Loop * L, bool isSigned, bool ControlsExit, bool AllowPredicates = false)
  • private void insertValueToMap(llvm::Value * V, const llvm::SCEV * S)
  • public bool instructionCouldExistWitthOperands(const llvm::SCEV * A, const llvm::SCEV * B)
  • public bool invalidate(llvm::Function & F, const llvm::PreservedAnalyses & PA, FunctionAnalysisManager::Invalidator & Inv)
  • private bool isAddRecNeverPoison(const llvm::Instruction * I, const llvm::Loop * L)
  • public bool isAvailableAtLoopEntry(const llvm::SCEV * S, const llvm::Loop * L)
  • public bool isBackedgeTakenCountMaxOrZero(const llvm::Loop * L)
  • public bool isBasicBlockEntryGuardedByCond(const llvm::BasicBlock * BB, ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • private bool isGuaranteedToTransferExecutionTo(const llvm::Instruction * A, const llvm::Instruction * B)
  • private bool isImpliedCond(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::Value * FoundCondValue, bool Inverse, const llvm::Instruction * Context = nullptr)
  • private bool isImpliedCond(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, ICmpInst::Predicate FoundPred, const llvm::SCEV * FoundLHS, const llvm::SCEV * FoundRHS, const llvm::Instruction * Context = nullptr)
  • private bool isImpliedCondBalancedTypes(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, ICmpInst::Predicate FoundPred, const llvm::SCEV * FoundLHS, const llvm::SCEV * FoundRHS, const llvm::Instruction * CtxI)
  • private bool isImpliedCondOperands(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::SCEV * FoundLHS, const llvm::SCEV * FoundRHS, const llvm::Instruction * Context = nullptr)
  • private bool isImpliedCondOperandsHelper(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::SCEV * FoundLHS, const llvm::SCEV * FoundRHS)
  • private bool isImpliedCondOperandsViaAddRecStart(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::SCEV * FoundLHS, const llvm::SCEV * FoundRHS, const llvm::Instruction * CtxI)
  • private bool isImpliedCondOperandsViaNoOverflow(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::SCEV * FoundLHS, const llvm::SCEV * FoundRHS)
  • private bool isImpliedCondOperandsViaRanges(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::SCEV * FoundLHS, const llvm::SCEV * FoundRHS)
  • private bool isImpliedCondOperandsViaShift(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::SCEV * FoundLHS, const llvm::SCEV * FoundRHS)
  • private bool isImpliedViaGuard(const llvm::BasicBlock * BB, ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • private bool isImpliedViaMerge(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::SCEV * FoundLHS, const llvm::SCEV * FoundRHS, unsigned int Depth)
  • private bool isImpliedViaOperations(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::SCEV * FoundLHS, const llvm::SCEV * FoundRHS, unsigned int Depth = 0)
  • 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 isKnownPredicateAt(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS, const llvm::Instruction * CtxI)
  • private bool isKnownPredicateViaConstantRanges(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • private bool isKnownPredicateViaNoOverflow(ICmpInst::Predicate Pred, const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • private bool isKnownPredicateViaSplitting(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)
  • private bool isKnownViaNonRecursiveReasoning(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)
  • private bool isSCEVExprNeverPoison(const llvm::Instruction * I)
  • public bool isSCEVable(llvm::Type * Ty) const
  • public bool loopHasNoAbnormalExits(const llvm::Loop * L)
  • private bool loopHasNoSideEffects(const llvm::Loop * L)
  • public bool loopIsFiniteByAssumption(const llvm::Loop * L)
  • public static SCEV::NoWrapFlags maskFlags(SCEV::NoWrapFlags Flags, int Mask)
  • private bool matchURem(const llvm::SCEV * Expr, const llvm::SCEV *& LHS, const llvm::SCEV *& RHS)
  • public void print(llvm::raw_ostream & OS) const
  • public bool properlyDominates(const llvm::SCEV * S, const llvm::BasicBlock * BB)
  • private SCEV::NoWrapFlags proveNoSignedWrapViaInduction(const llvm::SCEVAddRecExpr * AR)
  • private SCEV::NoWrapFlags proveNoUnsignedWrapViaInduction(const llvm::SCEVAddRecExpr * AR)
  • private template <typename ExtendOpTy>bool proveNoWrapByVaryingStart(const llvm::SCEV * Start, const llvm::SCEV * Step, const llvm::Loop * L)
  • private SCEV::NoWrapFlags proveNoWrapViaConstantRanges(const llvm::SCEVAddRecExpr * AR)
  • public void registerUser(const llvm::SCEV * User, ArrayRef<const llvm::SCEV *> Ops)
  • public const llvm::SCEV * removePointerBase(const llvm::SCEV * S)
  • public const llvm::SCEV * rewriteUsingPredicate(const llvm::SCEV * S, const llvm::Loop * L, const llvm::SCEVPredicate & A)
  • public static SCEV::NoWrapFlags setFlags(SCEV::NoWrapFlags Flags, SCEV::NoWrapFlags OnFlags)
  • public void setNoWrapFlags(llvm::SCEVAddRecExpr * AddRec, SCEV::NoWrapFlags Flags)
  • private const llvm::ConstantRange & setRange(const llvm::SCEV * S, llvm::ScalarEvolution::RangeSignHint Hint, llvm::ConstantRange CR)
  • private bool splitBinaryAdd(const llvm::SCEV * Expr, const llvm::SCEV *& L, const llvm::SCEV *& R, SCEV::NoWrapFlags & Flags)
  • private const llvm::SCEV * stripInjectiveFunctions(const llvm::SCEV * Val) const
  • public void verify() const
  • public bool willNotOverflow(Instruction::BinaryOps BinOp, bool Signed, const llvm::SCEV * LHS, const llvm::SCEV * RHS)
  • 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:944

Parameters

const llvm::SCEV* S

uint32_t GetMinTrailingZerosImpl(
    const llvm::SCEV* S)

Description

Private helper method for the GetMinTrailingZeros method

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

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:486

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:488

Parameters

llvm::ScalarEvolution&& Arg

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

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. ControllingFiniteLoop is set if this comparison controls the exit of a loop known to have a finite number of iterations.

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

Parameters

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

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:1009

Parameters

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

const llvm::SCEV* applyLoopGuards(
    const llvm::SCEV* Expr,
    const llvm::Loop* L)

Description

Try to apply information from loop guards for \p L to \p Expr.

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

Parameters

const llvm::SCEV* Expr
const llvm::Loop* L

bool canIVOverflowOnGT(const llvm::SCEV* RHS,
                       const llvm::SCEV* Stride,
                       bool IsSigned)

Description

Verify if an linear IV with negative stride can overflow when in a greater-than comparison, knowing the invariant term of the comparison, the stride.

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

Parameters

const llvm::SCEV* RHS
const llvm::SCEV* Stride
bool IsSigned

bool canIVOverflowOnLT(const llvm::SCEV* RHS,
                       const llvm::SCEV* Stride,
                       bool IsSigned)

Description

Verify if an linear IV with positive stride can overflow when in a less-than comparison, knowing the invariant term of the comparison, the stride.

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

Parameters

const llvm::SCEV* RHS
const llvm::SCEV* Stride
bool IsSigned

bool checkValidity(const llvm::SCEV* S) const

Description

Return false iff given SCEV contains a SCEVUnknown with NULL value- pointer.

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

Parameters

const llvm::SCEV* S

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

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

Parameters

SCEV::NoWrapFlags Flags
SCEV::NoWrapFlags OffFlags

llvm::ScalarEvolution::BackedgeTakenInfo
computeBackedgeTakenCount(
    const llvm::Loop* L,
    bool AllowPredicates = false)

Description

Compute the number of times the specified loop will iterate. If AllowPredicates is set, we will create new SCEV predicates as necessary in order to return an exact answer.

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

Parameters

const llvm::Loop* L
bool AllowPredicates = false

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

Description

Compute a BlockDisposition value.

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

Parameters

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

Optional<llvm::APInt> computeConstantDifference(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Description

Compute \p LHS - \p RHS and returns the result as an APInt if it is a constant, and None if it isn't. This is intended to be a cheaper version of getMinusSCEV. We can be frugal here since we just bail out of actually constructing and canonicalizing an expression in the cases where the result isn't going to be a constant.

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

Parameters

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

const llvm::SCEV* computeExitCountExhaustively(
    const llvm::Loop* L,
    llvm::Value* Cond,
    bool ExitWhen)

Description

If the loop is known to execute a constant number of times (the condition evolves only from constants), try to evaluate a few iterations of the loop until we get the exit condition gets a value of ExitWhen (true or false). If we cannot evaluate the exit count of the loop, return CouldNotCompute.

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

Parameters

const llvm::Loop* L
llvm::Value* Cond
bool ExitWhen

llvm::ScalarEvolution::ExitLimit computeExitLimit(
    const llvm::Loop* L,
    llvm::BasicBlock* ExitingBlock,
    bool AllowPredicates = false)

Description

Compute the number of times the backedge of the specified loop will execute if it exits via the specified block. If AllowPredicates is set, this call will try to use a minimal set of SCEV predicates in order to return an exact answer.

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

Parameters

const llvm::Loop* L
llvm::BasicBlock* ExitingBlock
bool AllowPredicates = false

llvm::ScalarEvolution::ExitLimit
computeExitLimitFromCond(
    const llvm::Loop* L,
    llvm::Value* ExitCond,
    bool ExitIfTrue,
    bool ControlsExit,
    bool AllowPredicates = false)

Description

Compute the number of times the backedge of the specified loop will execute if its exit condition were a conditional branch of ExitCond. \p ControlsExit is true if ExitCond directly controls the exit branch. In this case, we can assume that the loop exits only if the condition is true and can infer that failing to meet the condition prior to integer wraparound results in undefined behavior. If \p AllowPredicates is set, this call will try to use a minimal set of SCEV predicates in order to return an exact answer.

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

Parameters

const llvm::Loop* L
llvm::Value* ExitCond
bool ExitIfTrue
bool ControlsExit
bool AllowPredicates = false

llvm::ScalarEvolution::ExitLimit
computeExitLimitFromCondCached(
    llvm::ScalarEvolution::ExitLimitCacheTy&
        Cache,
    const llvm::Loop* L,
    llvm::Value* ExitCond,
    bool ExitIfTrue,
    bool ControlsExit,
    bool AllowPredicates)

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

Parameters

llvm::ScalarEvolution::ExitLimitCacheTy& Cache
const llvm::Loop* L
llvm::Value* ExitCond
bool ExitIfTrue
bool ControlsExit
bool AllowPredicates

Optional<ScalarEvolution::ExitLimit>
computeExitLimitFromCondFromBinOp(
    llvm::ScalarEvolution::ExitLimitCacheTy&
        Cache,
    const llvm::Loop* L,
    llvm::Value* ExitCond,
    bool ExitIfTrue,
    bool ControlsExit,
    bool AllowPredicates)

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

Parameters

llvm::ScalarEvolution::ExitLimitCacheTy& Cache
const llvm::Loop* L
llvm::Value* ExitCond
bool ExitIfTrue
bool ControlsExit
bool AllowPredicates

llvm::ScalarEvolution::ExitLimit
computeExitLimitFromCondImpl(
    llvm::ScalarEvolution::ExitLimitCacheTy&
        Cache,
    const llvm::Loop* L,
    llvm::Value* ExitCond,
    bool ExitIfTrue,
    bool ControlsExit,
    bool AllowPredicates)

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

Parameters

llvm::ScalarEvolution::ExitLimitCacheTy& Cache
const llvm::Loop* L
llvm::Value* ExitCond
bool ExitIfTrue
bool ControlsExit
bool AllowPredicates

llvm::ScalarEvolution::ExitLimit
computeExitLimitFromICmp(
    const llvm::Loop* L,
    llvm::ICmpInst* ExitCond,
    bool ExitIfTrue,
    bool IsSubExpr,
    bool AllowPredicates = false)

Description

Compute the number of times the backedge of the specified loop will execute if its exit condition were a conditional branch of the ICmpInst ExitCond and ExitIfTrue. If AllowPredicates is set, this call will try to use a minimal set of SCEV predicates in order to return an exact answer.

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

Parameters

const llvm::Loop* L
llvm::ICmpInst* ExitCond
bool ExitIfTrue
bool IsSubExpr
bool AllowPredicates = false

llvm::ScalarEvolution::ExitLimit
computeExitLimitFromICmp(
    const llvm::Loop* L,
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    bool IsSubExpr,
    bool AllowPredicates = false)

Description

Variant of previous which takes the components representing an ICmp as opposed to the ICmpInst itself. Note that the prior version can return more precise results in some cases and is preferred when caller has a materialized ICmp.

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

Parameters

const llvm::Loop* L
ICmpInst::Predicate Pred
const llvm::SCEV* LHS
const llvm::SCEV* RHS
bool IsSubExpr
bool AllowPredicates = false

llvm::ScalarEvolution::ExitLimit
computeExitLimitFromSingleExitSwitch(
    const llvm::Loop* L,
    llvm::SwitchInst* Switch,
    llvm::BasicBlock* ExitingBB,
    bool IsSubExpr)

Description

Compute the number of times the backedge of the specified loop will execute if its exit condition were a switch with a single exiting case to ExitingBB.

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

Parameters

const llvm::Loop* L
llvm::SwitchInst* Switch
llvm::BasicBlock* ExitingBB
bool IsSubExpr

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

Description

Compute a LoopDisposition value.

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

Parameters

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

const llvm::SCEV* computeMaxBECountForLT(
    const llvm::SCEV* Start,
    const llvm::SCEV* Stride,
    const llvm::SCEV* End,
    unsigned int BitWidth,
    bool IsSigned)

Description

Compute the maximum backedge count based on the range of values permitted by Start, End, and Stride. This is for loops of the form {Start, +, Stride} LT End. Preconditions: * the induction variable is known to be positive. * the induction variable is assumed not to overflow (i.e. either it actually doesn't, or we'd have to immediately execute UB) We *don't* assert these preconditions so please be careful.

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

Parameters

const llvm::SCEV* Start
const llvm::SCEV* Stride
const llvm::SCEV* End
unsigned int BitWidth
bool IsSigned

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

Description

Implementation code for getSCEVAtScope; called at most once for each SCEV+Loop pair.

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

Parameters

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

llvm::ScalarEvolution::ExitLimit
computeShiftCompareExitLimit(
    llvm::Value* LHS,
    llvm::Value* RHS,
    const llvm::Loop* L,
    ICmpInst::Predicate Pred)

Description

Compute the exit limit of a loop that is controlled by a "(IV >> 1) != 0" type comparison. We cannot compute the exact trip count in these cases (since SCEV has no way of expressing them), but we can still sometimes compute an upper bound. Return an ExitLimit for a loop whose backedge is guarded by `LHS Pred RHS`.

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

Parameters

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

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

Description

Return a symbolic upper bound for the backedge taken count of the loop. This is more general than getConstantMaxBackedgeTakenCount as it returns an arbitrary expression as opposed to only constants.

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

Parameters

const llvm::Loop* L

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:529

Parameters

const llvm::SCEV* S

bool containsErasedValue(
    const llvm::SCEV* S) const

Description

Return true if the SCEV expression contains a Value that has been optimised out and is now a nullptr.

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

Parameters

const llvm::SCEV* S

bool containsUndefs(const llvm::SCEV* S) const

Description

Return true if the SCEV expression contains an undef value.

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

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:1176

Parameters

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

const llvm::SCEV* createAddRecFromPHI(
    llvm::PHINode* PN)

Description

Helper function called from createNodeForPHI.

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

Parameters

llvm::PHINode* PN

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:616

Parameters

const llvm::SCEVUnknown* SymbolicPHI

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

Description

Similar to createAddRecFromPHI, but with the additional flexibility of suggesting runtime overflow checks in case casts are encountered. If successful, the analysis records that for this loop, \p SymbolicPHI, which is the UnknownSCEV currently representing the PHI, can be rewritten into an AddRec, assuming some predicates; The function then returns the AddRec and the predicates as a pair, and caches this pair in PredicatedSCEVRewrites. If the analysis is not successful, a mapping from the \p SymbolicPHI to itself (with no predicates) is recorded, and a nullptr with an empty predicates vector is returned as a pair.

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

Parameters

const llvm::SCEVUnknown* SymbolicPHI

const llvm::SCEV* createNodeForGEP(
    llvm::GEPOperator* GEP)

Description

Provide the special handling we need to analyze GEP SCEVs.

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

Parameters

llvm::GEPOperator* GEP

const llvm::SCEV* createNodeForPHI(
    llvm::PHINode* PN)

Description

Provide the special handling we need to analyze PHI SCEVs.

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

Parameters

llvm::PHINode* PN

const llvm::SCEV* createNodeForSelectOrPHI(
    llvm::Value* V,
    llvm::Value* Cond,
    llvm::Value* TrueVal,
    llvm::Value* FalseVal)

Description

Given a value \p V, which is a select-like instruction (currently this is either a select instruction or a phi node), which is assumed equivalent to Cond ? TrueVal : FalseVal see if we can model it as a SCEV expression.

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

Parameters

llvm::Value* V
llvm::Value* Cond
llvm::Value* TrueVal
llvm::Value* FalseVal

const llvm::SCEV*
createNodeForSelectOrPHIInstWithICmpInstCond(
    llvm::Instruction* I,
    llvm::ICmpInst* Cond,
    llvm::Value* TrueVal,
    llvm::Value* FalseVal)

Description

Provide special handling for a select-like instruction (currently this is either a select instruction or a phi node). \p I is the instruction being processed, and it is assumed equivalent to "Cond ? TrueVal : FalseVal".

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

Parameters

llvm::Instruction* I
llvm::ICmpInst* Cond
llvm::Value* TrueVal
llvm::Value* FalseVal

const llvm::SCEV*
createNodeForSelectOrPHIViaUMinSeq(
    llvm::Value* I,
    llvm::Value* Cond,
    llvm::Value* TrueVal,
    llvm::Value* FalseVal)

Description

See if we can model this select-like instruction via umin_seq expression.

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

Parameters

llvm::Value* I
llvm::Value* Cond
llvm::Value* TrueVal
llvm::Value* FalseVal

const llvm::SCEV* createNodeFromSelectLikePHI(
    llvm::PHINode* PN)

Description

Helper function called from createNodeForPHI.

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

Parameters

llvm::PHINode* PN

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

Description

We know that there is no SCEV for the specified value. Analyze the expression recursively.

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

Parameters

llvm::Value* V

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

Description

We know that there is no SCEV for the specified value. Create a new SCEV for \p V iteratively.

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

Parameters

llvm::Value* V

const llvm::SCEV* createSimpleAffineAddRec(
    llvm::PHINode* PN,
    llvm::Value* BEValueV,
    llvm::Value* StartValueV)

Description

A helper function for createAddRecFromPHI to handle simple cases.

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

Parameters

llvm::PHINode* PN
llvm::Value* BEValueV
llvm::Value* StartValueV

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:1140

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:1953

Parameters

llvm::Value* V

Optional<bool> evaluatePredicate(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Description

Check whether the condition described by Pred, LHS, and RHS is true or false. If we know it, return the evaluation of this condition. If neither is proved, return None.

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

Parameters

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

Optional<bool> evaluatePredicateAt(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::Instruction* CtxI)

Description

Check whether the condition described by Pred, LHS, and RHS is true or false in the given \p Context. If we know it, return the evaluation of this condition. If neither is proved, return None.

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

Parameters

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

llvm::SCEV* findExistingSCEVInCache(
    llvm::SCEVTypes SCEVType,
    ArrayRef<const llvm::SCEV*> Ops)

Description

Look for a SCEV expression with type `SCEVType` and operands `Ops` in `UniqueSCEVs`. Return if found, else nullptr.

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

Parameters

llvm::SCEVTypes SCEVType
ArrayRef<const llvm::SCEV*> Ops

void forgetAllLoops()

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

void forgetBackedgeTakenCounts(
    const llvm::Loop* L,
    bool Predicated)

Description

Forget predicated/non-predicated backedge taken counts for the given loop.

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

Parameters

const llvm::Loop* L
bool Predicated

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:920

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:938

Parameters

const llvm::Loop* L

void forgetMemoizedResults(
    ArrayRef<const llvm::SCEV*> SCEVs)

Description

Drop memoized information for all \p SCEVs.

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

Parameters

ArrayRef<const llvm::SCEV*> SCEVs

void forgetMemoizedResultsImpl(
    const llvm::SCEV* S)

Description

Helper for forgetMemoizedResults.

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

Parameters

const llvm::SCEV* S

void forgetTopmostLoop(const llvm::Loop* L)

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

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:931

Parameters

llvm::Value* V

const llvm::SCEV* getAbsExpr(const llvm::SCEV* Op,
                             bool IsNSW)

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

Parameters

const llvm::SCEV* Op
bool IsNSW

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:577

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* 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:571

Parameters

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

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:568

Parameters

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

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:605

Parameters

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

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

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

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:601

Parameters

const llvm::SCEV* Start
const llvm::SCEV* Step
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:567

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:876

Parameters

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

llvm::ScalarEvolution::BackedgeTakenInfo&
getBackedgeTakenInfo(const llvm::Loop* L)

Description

Return the BackedgeTakenInfo for the given loop, lazily computing new values if the loop hasn't been analyzed yet. The returned result is guaranteed not to be predicated.

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

Parameters

const llvm::Loop* L

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:1136

Parameters

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

const llvm::SCEV* getCastExpr(
    llvm::SCEVTypes Kind,
    const llvm::SCEV* Op,
    llvm::Type* Ty)

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

Parameters

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

const llvm::SCEVPredicate* getComparePredicate(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

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

Parameters

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

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

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

Parameters

const llvm::APInt& Val

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

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

Parameters

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

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

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

Parameters

llvm::ConstantInt* V

llvm::Constant* getConstantEvolutionLoopExitValue(
    llvm::PHINode* PN,
    const llvm::APInt& BEs,
    const llvm::Loop* L)

Description

If we know that the specified Phi is in the header of its containing loop, we know the loop executes a constant number of times, and the PHI node is just a recurrence involving constants, fold it.

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

Parameters

llvm::PHINode* PN
const llvm::APInt& BEs
const llvm::Loop* L

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:889

Parameters

const llvm::Loop* L

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

Description

Returns the upper bound of the loop trip count infered from array size. Can not access bytes starting outside the statically allocated size without being immediate UB. Returns SCEVCouldNotCompute if the trip count could not inferred from array accesses.

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

Parameters

const llvm::Loop* L

llvm::LLVMContext& getContext() const

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

const llvm::SCEV* getCouldNotCompute()

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

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:1159

const llvm::Instruction* getDefiningScopeBound(
    ArrayRef<const llvm::SCEV*> Ops)

Description

Wrapper around the above for cases which don't care if the bound is precise.

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

Parameters

ArrayRef<const llvm::SCEV*> Ops

const llvm::Instruction* getDefiningScopeBound(
    ArrayRef<const llvm::SCEV*> Ops,
    bool& Precise)

Description

Return a scope which provides an upper bound on the defining scope for a SCEV with the operands in Ops. The outparam Precise is set if the bound found is a precise bound (i.e. must be the defining scope.)

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

Parameters

ArrayRef<const llvm::SCEV*> Ops
bool& Precise

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:506

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:1150

Parameters

llvm::Instruction* Inst

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

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

Parameters

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

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

Description

Return an existing SCEV for V if there is one, otherwise return nullptr.

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

Parameters

llvm::Value* V

const llvm::SCEV* getExitCount(
    const llvm::Loop* L,
    const 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:863

Parameters

const llvm::Loop* L
const 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:623

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:1117

Parameters

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

Optional<
    llvm::ScalarEvolution::LoopInvariantPredicate>
getLoopInvariantExitCondDuringFirstIterations(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::Loop* L,
    const llvm::Instruction* CtxI,
    const llvm::SCEV* MaxIter)

Description

If the result of the predicate LHS `Pred` RHS is loop invariant with respect to L at given Context during at least first MaxIter iterations, return a LoopInvariantPredicate with LHS and RHS being invariants, available at L's entry. Otherwise, return None. The predicate should be the loop's exit condition.

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

Parameters

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

Optional<
    llvm::ScalarEvolution::LoopInvariantPredicate>
getLoopInvariantPredicate(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::Loop* L)

Description

If the result of the predicate LHS `Pred` RHS is loop invariant with respect to L, return a LoopInvariantPredicate with LHS and RHS being invariants, available at L's entry. Otherwise, return None.

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

Parameters

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

llvm::ScalarEvolution::LoopProperties
getLoopProperties(const llvm::Loop* L)

Description

Return a \c LoopProperties instance for \p L, creating one if necessary.

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

Parameters

const llvm::Loop* L

const llvm::SCEV* getLosslessPtrToIntExpr(
    const llvm::SCEV* Op,
    unsigned int Depth = 0)

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

Parameters

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

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

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

Parameters

llvm::SCEVTypes Kind
SmallVectorImpl<const llvm::SCEV*>& Operands

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

Description

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

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

Parameters

llvm::Type* Ty

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. If the LHS and RHS are pointers which don't share a common base (according to getPointerBase()), this returns a SCEVCouldNotCompute. To compute the difference between two unrelated pointers, you can explicitly convert the arguments using getPtrToIntExpr(), for pointer types that support it.

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

Parameters

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

Optional<
    llvm::ScalarEvolution::MonotonicPredicateType>
getMonotonicPredicateType(
    const llvm::SCEVAddRecExpr* LHS,
    ICmpInst::Predicate Pred)

Description

If, for all loop invariant X, the predicate "LHS `Pred` X" is monotonically increasing or decreasing, returns Some(MonotonicallyIncreasing) and Some(MonotonicallyDecreasing) respectively. If we could not prove either of these facts, returns None.

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

Parameters

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

Optional<
    llvm::ScalarEvolution::MonotonicPredicateType>
getMonotonicPredicateTypeImpl(
    const llvm::SCEVAddRecExpr* LHS,
    ICmpInst::Predicate Pred)

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

Parameters

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

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:583

Parameters

SmallVectorImpl<const llvm::SCEV*>& Ops
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:586

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:592

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* 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:669

Parameters

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

SCEV::NoWrapFlags getNoWrapFlagsFromUB(
    const llvm::Value* V)

Description

Return SCEV no-wrap flags that can be proven based on reasoning about how poison produced from no-wrap flags on this value (e.g. a nuw add) would trigger undefined behavior on overflow.

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

Parameters

const llvm::Value* V

const llvm::Instruction*
getNonTrivialDefiningScopeBound(
    const llvm::SCEV* S)

Description

Return a scope which provides an upper bound on the defining scope of 'S'. Specifically, return the first instruction in said bounding scope. Return nullptr if the scope is trivial (function entry). (See scope definition rules associated with flag discussion above)

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

Parameters

const llvm::SCEV* S

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:719

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:714

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:709

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:673

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:666

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:647

Parameters

llvm::Type* Ty

const llvm::SCEV* getOperandsToCreate(
    llvm::Value* V,
    SmallVectorImpl<llvm::Value*>& Ops)

Description

Collect operands of \p V for which SCEV expressions should be constructed first. Returns a SCEV directly if it can be constructed trivially for \p V.

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

Parameters

llvm::Value* V
SmallVectorImpl<llvm::Value*>& Ops

const llvm::SCEV* getOrCreateAddExpr(
    ArrayRef<const llvm::SCEV*> Ops,
    SCEV::NoWrapFlags Flags)

Description

Get add expr already created or create a new one.

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

Parameters

ArrayRef<const llvm::SCEV*> Ops
SCEV::NoWrapFlags Flags

const llvm::SCEV* getOrCreateAddRecExpr(
    ArrayRef<const llvm::SCEV*> Ops,
    const llvm::Loop* L,
    SCEV::NoWrapFlags Flags)

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

Parameters

ArrayRef<const llvm::SCEV*> Ops
const llvm::Loop* L
SCEV::NoWrapFlags Flags

const llvm::SCEV* getOrCreateMulExpr(
    ArrayRef<const llvm::SCEV*> Ops,
    SCEV::NoWrapFlags Flags)

Description

Get mul expr already created or create a new one.

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

Parameters

ArrayRef<const llvm::SCEV*> Ops
SCEV::NoWrapFlags Flags

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:743

Parameters

const llvm::SCEV* V

std::pair<const BasicBlock*, const BasicBlock*>
getPredecessorWithUniqueSuccessorForBB(
    const llvm::BasicBlock* BB) const

Description

Return a predecessor of BB (which may not be an immediate predecessor) which has exactly one successor from which BB is reachable, or null if no such block is found.

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

Parameters

const llvm::BasicBlock* BB

const llvm::SCEV* getPredicatedBackedgeTakenCount(
    const llvm::Loop* L,
    SmallVector<const llvm::SCEVPredicate*, 4>&
        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:882

Parameters

const llvm::Loop* L
SmallVector<const llvm::SCEVPredicate*, 4>& Predicates

const llvm::ScalarEvolution::BackedgeTakenInfo&
getPredicatedBackedgeTakenInfo(
    const llvm::Loop* L)

Description

Similar to getBackedgeTakenInfo, but will add predicates as required with the purpose of returning complete information.

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

Parameters

const llvm::Loop* L

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

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

Parameters

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

llvm::ConstantRange getRangeForAffineAR(
    const llvm::SCEV* Start,
    const llvm::SCEV* Step,
    const llvm::SCEV* MaxBECount,
    unsigned int BitWidth)

Description

Determines the range for the affine SCEVAddRecExpr {\p Start,+, \p Step}. Helper for \c getRange.

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

Parameters

const llvm::SCEV* Start
const llvm::SCEV* Step
const llvm::SCEV* MaxBECount
unsigned int BitWidth

llvm::ConstantRange
getRangeForAffineNoSelfWrappingAR(
    const llvm::SCEVAddRecExpr* AddRec,
    const llvm::SCEV* MaxBECount,
    unsigned int BitWidth,
    llvm::ScalarEvolution::RangeSignHint SignHint)

Description

Determines the range for the affine non-self-wrapping SCEVAddRecExpr {\p Start,+, \p Step}<nw>.

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

Parameters

const llvm::SCEVAddRecExpr* AddRec
const llvm::SCEV* MaxBECount
unsigned int BitWidth
llvm::ScalarEvolution::RangeSignHint SignHint

llvm::ConstantRange getRangeForUnknownRecurrence(
    const llvm::SCEVUnknown* U)

Description

If the unknown expression U corresponds to a simple recurrence, return a constant range which represents the entire recurrence. Note that *add* recurrences with loop invariant steps aren't represented by SCEVUnknowns and thus don't use this mechanism.

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

Parameters

const llvm::SCEVUnknown* U

const llvm::ConstantRange& getRangeRef(
    const llvm::SCEV* S,
    llvm::ScalarEvolution::RangeSignHint Hint)

Description

Determine the range for a particular SCEV. NOTE: This returns a reference to an entry in a cache. It must be copied if its needed for longer.

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

Parameters

const llvm::SCEV* S
llvm::ScalarEvolution::RangeSignHint Hint

llvm::ConstantRange getRangeViaFactoring(
    const llvm::SCEV* Start,
    const llvm::SCEV* Step,
    const llvm::SCEV* MaxBECount,
    unsigned int BitWidth)

Description

Try to compute a range for the affine SCEVAddRecExpr {\p Start,+, \p Step} by "factoring out" a ternary expression from the add recurrence. Helper called by \c getRange.

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

Parameters

const llvm::SCEV* Start
const llvm::SCEV* Step
const llvm::SCEV* MaxBECount
unsigned int BitWidth

void getReachableBlocks(
    SmallPtrSetImpl<llvm::BasicBlock*>& Reachable,
    llvm::Function& F)

Description

Get reachable blocks in this function, making limited use of SCEV reasoning about conditions.

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

Parameters

SmallPtrSetImpl<llvm::BasicBlock*>& Reachable
llvm::Function& F

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:556

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:761

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:758

Parameters

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

ArrayRef<llvm::Value*> getSCEVValues(
    const llvm::SCEV* S)

Description

Return the Value set from which the SCEV expr is generated.

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

Parameters

const llvm::SCEV* S

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

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

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:631

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:634

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:635

Parameters

SmallVectorImpl<const llvm::SCEV*>& Operands

const llvm::SCEV* getSequentialMinMaxExpr(
    llvm::SCEVTypes Kind,
    SmallVectorImpl<const llvm::SCEV*>& Operands)

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

Parameters

llvm::SCEVTypes Kind
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:565

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:964

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:974

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:969

Parameters

const llvm::SCEV* S

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

Description

Return an expression for the alloc size of AllocTy that is type IntTy

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

Parameters

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

const llvm::SCEV* getSizeOfScalableVectorExpr(
    llvm::Type* IntTy,
    llvm::ScalableVectorType* ScalableTy)

Description

Return an expression for sizeof ScalableTy that is type IntTy, where ScalableTy is a scalable vector type.

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

Parameters

llvm::Type* IntTy
llvm::ScalableVectorType* ScalableTy

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:812

Parameters

const llvm::Loop* L

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

Description

Returns the exact trip count of the loop if we can compute it, and the result is a small constant. '0' is used to represent an unknown or non-constant trip count. Note that a trip count is simply one more than the backedge taken count for the loop.

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

Parameters

const llvm::Loop* L

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

Description

Return the exact trip count for this loop if we exit through ExitingBlock. '0' is used to represent an unknown or non-constant trip count. Note that a trip count is simply one more than the backedge taken count for the same exit. This "trip count" assumes that control exits via ExitingBlock. More precisely, it is the number of times that control will 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:806

Parameters

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

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

Description

Returns the largest constant divisor of the trip count of the loop. Will return 1 if no trip count could be computed, or if a divisor could not be found.

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

Parameters

const llvm::Loop* L

unsigned int getSmallConstantTripMultiple(
    const llvm::Loop* L,
    const llvm::SCEV* ExitCount)

Description

Returns the largest constant divisor of the trip count as a normal unsigned value, if possible. This means that the actual trip count is always a multiple of the returned value. Returns 1 if the trip count is unknown or not guaranteed to be the multiple of a constant., Will also return 1 if the trip count is very large (>= 2^32). Note that the argument is an exit count for loop L, NOT a trip count.

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

Parameters

const llvm::Loop* L
const llvm::SCEV* ExitCount

unsigned int getSmallConstantTripMultiple(
    const llvm::Loop* L,
    const 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:841

Parameters

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

const llvm::SCEV* getStoreSizeOfExpr(
    llvm::Type* IntTy,
    llvm::Type* StoreTy)

Description

Return an expression for the store size of StoreTy that is type IntTy

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

Parameters

llvm::Type* IntTy
llvm::Type* StoreTy

Optional<SCEV::NoWrapFlags>
getStrengthenedNoWrapFlagsFromBinOp(
    const llvm::OverflowingBinaryOperator* OBO)

Description

Parse NSW/NUW flags from add/sub/mul IR binary operation \p Op into SCEV no-wrap flags, and deduce flag[s] that aren't known yet. Does not mutate the original instruction. Returns None if it could not deduce more precise flags than the instruction already has, otherwise returns proven flags.

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

Parameters

const llvm::OverflowingBinaryOperator* OBO

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

Description

When successful, this returns a SCEV 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:897

Parameters

const llvm::Loop* L

const llvm::SCEV* getTripCountFromExitCount(
    const llvm::SCEV* ExitCount,
    bool Extend = true)

Description

Convert from an "exit count" (i.e. "backedge taken count") to a "trip count". A "trip count" is the number of times the header of the loop will execute if an exit is taken after the specified number of backedges have been taken. (e.g. TripCount = ExitCount + 1). Note that the expression can overflow if ExitCount = UINT_MAX. \p Extend controls how potential overflow is handled. If true, a wider result type is returned. ex: EC = 255 (i8), TC = 256 (i9). If false, result unsigned wraps with 2s-complement semantics. ex: EC = 255 (i8), TC = 0 (i8)

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

Parameters

const llvm::SCEV* ExitCount
bool Extend = true

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

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

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:723

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:703

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:698

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:501

Parameters

llvm::Type* Ty

const llvm::SCEV* getUDivCeilSCEV(
    const llvm::SCEV* N,
    const llvm::SCEV* D)

Description

Compute ceil(N / D). N and D are treated as unsigned values. Since SCEV doesn't have native ceiling division, this generates a SCEV expression of the following form: umin(N, 1) + floor((N - umin(N, 1)) / D) A denominator of zero or poison is handled the same way as getUDivExpr().

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

Parameters

const llvm::SCEV* N
const llvm::SCEV* D

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

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

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:598

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:633

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:632

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:727

Parameters

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

const llvm::SCEV* getUMinExpr(
    SmallVectorImpl<const llvm::SCEV*>& Operands,
    bool Sequential = false)

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

Parameters

SmallVectorImpl<const llvm::SCEV*>& Operands
bool Sequential = false

const llvm::SCEV* getUMinExpr(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    bool Sequential = false)

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

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS
bool Sequential = false

const llvm::SCEV* getUMinFromMismatchedTypes(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    bool Sequential = false)

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:731

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS
bool Sequential = false

const llvm::SCEV* getUMinFromMismatchedTypes(
    SmallVectorImpl<const llvm::SCEV*>& Ops,
    bool Sequential = false)

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:736

Parameters

SmallVectorImpl<const llvm::SCEV*>& Ops
bool Sequential = false

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

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

Parameters

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

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

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

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:948

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:958

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:953

Parameters

const llvm::SCEV* S

void getUsedLoops(
    const llvm::SCEV* S,
    SmallPtrSetImpl<const llvm::Loop*>& LoopsUsed)

Description

Find all of the loops transitively used in \p S, and fill \p LoopsUsed. A loop is considered "used" by an expression if it contains an add rec on said loop.

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

Parameters

const llvm::SCEV* S
SmallPtrSetImpl<const llvm::Loop*>& LoopsUsed

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

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

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:1168

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:644

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:564

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:1132

Parameters

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

static bool hasFlags(SCEV::NoWrapFlags Flags,
                     SCEV::NoWrapFlags TestFlags)

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

Parameters

SCEV::NoWrapFlags Flags
SCEV::NoWrapFlags TestFlags

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:907

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:1147

Parameters

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

llvm::ScalarEvolution::ExitLimit howFarToNonZero(
    const llvm::SCEV* V,
    const llvm::Loop* L)

Description

Return the number of times an exit condition checking the specified value for nonzero will execute. If not computable, return CouldNotCompute.

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

Parameters

const llvm::SCEV* V
const llvm::Loop* L

llvm::ScalarEvolution::ExitLimit howFarToZero(
    const llvm::SCEV* V,
    const llvm::Loop* L,
    bool IsSubExpr,
    bool AllowPredicates = false)

Description

Return the number of times an exit condition comparing the specified value to zero will execute. If not computable, return CouldNotCompute. If AllowPredicates is set, this call will try to use a minimal set of SCEV predicates in order to return an exact answer.

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

Parameters

const llvm::SCEV* V
const llvm::Loop* L
bool IsSubExpr
bool AllowPredicates = false

llvm::ScalarEvolution::ExitLimit
howManyGreaterThans(const llvm::SCEV* LHS,
                    const llvm::SCEV* RHS,
                    const llvm::Loop* L,
                    bool isSigned,
                    bool IsSubExpr,
                    bool AllowPredicates = false)

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

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS
const llvm::Loop* L
bool isSigned
bool IsSubExpr
bool AllowPredicates = false

llvm::ScalarEvolution::ExitLimit howManyLessThans(
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::Loop* L,
    bool isSigned,
    bool ControlsExit,
    bool AllowPredicates = false)

Description

Return the number of times an exit condition containing the specified less-than comparison will execute. If not computable, return CouldNotCompute. \p isSigned specifies whether the less-than is signed. \p ControlsExit is true when the LHS < RHS condition directly controls the branch (loops exits only if condition is true). In this case, we can use NoWrapFlags to skip overflow checks. If \p AllowPredicates is set, this call will try to use a minimal set of SCEV predicates in order to return an exact answer.

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

Parameters

const llvm::SCEV* LHS
const llvm::SCEV* RHS
const llvm::Loop* L
bool isSigned
bool ControlsExit
bool AllowPredicates = false

void insertValueToMap(llvm::Value* V,
                      const llvm::SCEV* S)

Description

Insert V to S mapping into ValueExprMap and ExprValueMap.

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

Parameters

llvm::Value* V
const llvm::SCEV* S

bool instructionCouldExistWitthOperands(
    const llvm::SCEV* A,
    const llvm::SCEV* B)

Description

Return true if there exists a point in the program at which both A and B could be operands to the same instruction. SCEV expressions are generally assumed to correspond to instructions which could exists in IR. In general, this requires that there exists a use point in the program where all operands dominate the use. Example: loop { if loop { v1 = load @global1; } else loop { v2 = load @global2; } } No SCEV with operand V1, and v2 can exist in this program.

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

Parameters

const llvm::SCEV* A
const llvm::SCEV* B

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

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

Parameters

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

bool isAddRecNeverPoison(
    const llvm::Instruction* I,
    const llvm::Loop* L)

Description

This is like \c isSCEVExprNeverPoison but it specifically works for instructions that will get mapped to SCEV add recurrences. Return true if \p I will never generate poison under the assumption that \p I is an add recurrence on the loop \p L.

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

Parameters

const llvm::Instruction* I
const llvm::Loop* L

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:1126

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:903

Parameters

const llvm::Loop* L

bool isBasicBlockEntryGuardedByCond(
    const llvm::BasicBlock* BB,
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS)

Description

Test whether entry to the basic block is protected by a conditional between LHS and RHS.

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

Parameters

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

bool isGuaranteedToTransferExecutionTo(
    const llvm::Instruction* A,
    const llvm::Instruction* B)

Description

Given two instructions in the same function, return true if we can prove B must execute given A executes.

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

Parameters

const llvm::Instruction* A
const llvm::Instruction* B

bool isImpliedCond(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::Value* FoundCondValue,
    bool Inverse,
    const llvm::Instruction* Context = nullptr)

Description

Test whether the condition described by Pred, LHS, and RHS is true whenever the given FoundCondValue value evaluates to true in given Context. If Context is nullptr, then the found predicate is true everywhere. LHS and FoundLHS may have different type width.

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

Parameters

ICmpInst::Predicate Pred
const llvm::SCEV* LHS
const llvm::SCEV* RHS
const llvm::Value* FoundCondValue
bool Inverse
const llvm::Instruction* Context = nullptr

bool isImpliedCond(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    ICmpInst::Predicate FoundPred,
    const llvm::SCEV* FoundLHS,
    const llvm::SCEV* FoundRHS,
    const llvm::Instruction* Context = nullptr)

Description

Test whether the condition described by Pred, LHS, and RHS is true whenever the condition described by FoundPred, FoundLHS, FoundRHS is true in given Context. If Context is nullptr, then the found predicate is true everywhere.

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

Parameters

ICmpInst::Predicate Pred
const llvm::SCEV* LHS
const llvm::SCEV* RHS
ICmpInst::Predicate FoundPred
const llvm::SCEV* FoundLHS
const llvm::SCEV* FoundRHS
const llvm::Instruction* Context = nullptr

bool isImpliedCondBalancedTypes(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    ICmpInst::Predicate FoundPred,
    const llvm::SCEV* FoundLHS,
    const llvm::SCEV* FoundRHS,
    const llvm::Instruction* CtxI)

Description

Test whether the condition described by Pred, LHS, and RHS is true whenever the given FoundCondValue value evaluates to true in given Context. If Context is nullptr, then the found predicate is true everywhere. LHS and FoundLHS must have same type width.

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

Parameters

ICmpInst::Predicate Pred
const llvm::SCEV* LHS
const llvm::SCEV* RHS
ICmpInst::Predicate FoundPred
const llvm::SCEV* FoundLHS
const llvm::SCEV* FoundRHS
const llvm::Instruction* CtxI

bool isImpliedCondOperands(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::SCEV* FoundLHS,
    const llvm::SCEV* FoundRHS,
    const llvm::Instruction* Context = nullptr)

Description

Test whether the condition described by Pred, LHS, and RHS is true whenever the condition described by Pred, FoundLHS, and FoundRHS is true in given Context. If Context is nullptr, then the found predicate is true everywhere.

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

Parameters

ICmpInst::Predicate Pred
const llvm::SCEV* LHS
const llvm::SCEV* RHS
const llvm::SCEV* FoundLHS
const llvm::SCEV* FoundRHS
const llvm::Instruction* Context = nullptr

bool isImpliedCondOperandsHelper(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::SCEV* FoundLHS,
    const llvm::SCEV* FoundRHS)

Description

Test whether the condition described by Pred, LHS, and RHS is true whenever the condition described by Pred, FoundLHS, and FoundRHS is true.

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

Parameters

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

bool isImpliedCondOperandsViaAddRecStart(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::SCEV* FoundLHS,
    const llvm::SCEV* FoundRHS,
    const llvm::Instruction* CtxI)

Description

Test whether the condition described by Pred, LHS, and RHS is true whenever the condition described by Pred, FoundLHS, and FoundRHS is true. This routine tries to weaken the known condition basing on fact that FoundLHS is an AddRec.

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

Parameters

ICmpInst::Predicate Pred
const llvm::SCEV* LHS
const llvm::SCEV* RHS
const llvm::SCEV* FoundLHS
const llvm::SCEV* FoundRHS
const llvm::Instruction* CtxI

bool isImpliedCondOperandsViaNoOverflow(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::SCEV* FoundLHS,
    const llvm::SCEV* FoundRHS)

Description

Test whether the condition described by Pred, LHS, and RHS is true whenever the condition described by Pred, FoundLHS, and FoundRHS is true. This routine tries to rule out certain kinds of integer overflow, and then tries to reason about arithmetic properties of the predicates.

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

Parameters

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

bool isImpliedCondOperandsViaRanges(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::SCEV* FoundLHS,
    const llvm::SCEV* FoundRHS)

Description

Test whether the condition described by Pred, LHS, and RHS is true whenever the condition described by Pred, FoundLHS, and FoundRHS is true. Utility function used by isImpliedCondOperands. Tries to get cases like "X `sgt` 0 => X - 1 `sgt` -1".

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

Parameters

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

bool isImpliedCondOperandsViaShift(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::SCEV* FoundLHS,
    const llvm::SCEV* FoundRHS)

Description

Test whether the condition described by Pred, LHS, and RHS is true whenever the condition described by Pred, FoundLHS, and FoundRHS is true. This routine tries to reason about shifts.

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

Parameters

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

bool isImpliedViaGuard(const llvm::BasicBlock* BB,
                       ICmpInst::Predicate Pred,
                       const llvm::SCEV* LHS,
                       const llvm::SCEV* RHS)

Description

Return true if the condition denoted by \p LHS \p Pred \p RHS is implied by a call to @llvm.experimental.guard in \p BB.

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

Parameters

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

bool isImpliedViaMerge(ICmpInst::Predicate Pred,
                       const llvm::SCEV* LHS,
                       const llvm::SCEV* RHS,
                       const llvm::SCEV* FoundLHS,
                       const llvm::SCEV* FoundRHS,
                       unsigned int Depth)

Description

Test whether the condition described by Pred, LHS, and RHS is true whenever the condition described by Pred, FoundLHS, and FoundRHS is true. This routine tries to figure out predicate for Phis which are SCEVUnknown if it is true for every possible incoming value from their respective basic blocks.

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

Parameters

ICmpInst::Predicate Pred
const llvm::SCEV* LHS
const llvm::SCEV* RHS
const llvm::SCEV* FoundLHS
const llvm::SCEV* FoundRHS
unsigned int Depth

bool isImpliedViaOperations(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::SCEV* FoundLHS,
    const llvm::SCEV* FoundRHS,
    unsigned int Depth = 0)

Description

Test whether the condition described by Pred, LHS, and RHS is true whenever the condition described by Pred, FoundLHS, and FoundRHS is true. Here LHS is an operation that includes FoundLHS as one of its arguments.

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

Parameters

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

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:979

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:985

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:988

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:991

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:1057

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:982

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:1035

Parameters

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

bool isKnownPredicateAt(
    ICmpInst::Predicate Pred,
    const llvm::SCEV* LHS,
    const llvm::SCEV* RHS,
    const llvm::Instruction* CtxI)

Description

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

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

Parameters

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

bool isKnownPredicateViaConstantRanges(
    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 and the known constant ranges of LHS and RHS.

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

Parameters

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

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

Description

Try to prove the condition described by "LHS Pred RHS" by ruling out integer overflow. For instance, this will return true for "A s< (A + C)<nsw>" if C is positive.

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

Parameters

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

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

Description

Try to split Pred LHS RHS into logical conjunctions (and's) and try to prove them individually.

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

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:1030

Parameters

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

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

Description

Test whether the condition described by Pred, LHS, and RHS is true. Use only simple non-recursive types of checks, such as range analysis etc.

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

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:777

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:766

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:1121

Parameters

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

bool isSCEVExprNeverPoison(
    const llvm::Instruction* I)

Description

Return true if the SCEV corresponding to \p I is never poison. Proving this is more complex than proving that just \p I is never poison, since SCEV commons expressions across control flow, and you can have cases like: idx0 = a + b; ptr[idx0] = 100; if ( <condition >) { idx1 = a +nsw b; ptr[idx1] = 200; } where the SCEV expression (+ a b) is guaranteed to not be poison (and hence not sign-overflow) only if "<condition>" is true. Since both `idx0` and `idx1` will be mapped to the same SCEV expression, (+ a b), it is not okay to annotate (+ a b) with <nsw > in the above example.

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

Parameters

const llvm::Instruction* I

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:497

Parameters

llvm::Type* Ty

bool loopHasNoAbnormalExits(const llvm::Loop* L)

Description

Return true if the loop has no abnormal exits. That is, if the loop is not infinite, it must exit through an explicit edge in the CFG. (As opposed to either a) throwing out of the function or b) entering a well defined infinite loop in some callee.)

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

Parameters

const llvm::Loop* L

bool loopHasNoSideEffects(const llvm::Loop* L)

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

Parameters

const llvm::Loop* L

bool loopIsFiniteByAssumption(const llvm::Loop* L)

Description

Return true if this loop is finite by assumption. That is, to be infinite, it must also be undefined.

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

Parameters

const llvm::Loop* L

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:469

Parameters

SCEV::NoWrapFlags Flags
int Mask

bool matchURem(const llvm::SCEV* Expr,
               const llvm::SCEV*& LHS,
               const llvm::SCEV*& RHS)

Description

Try to match the pattern generated by getURemExpr(A, B). If successful, Assign A and B to LHS and RHS, respectively.

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

Parameters

const llvm::SCEV* Expr
const llvm::SCEV*& LHS
const llvm::SCEV*& RHS

void print(llvm::raw_ostream& OS) const

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

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:1144

Parameters

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

SCEV::NoWrapFlags proveNoSignedWrapViaInduction(
    const llvm::SCEVAddRecExpr* AR)

Description

Try to prove NSW on \p AR by proving facts about conditions known on entry and backedge.

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

Parameters

const llvm::SCEVAddRecExpr* AR

SCEV::NoWrapFlags proveNoUnsignedWrapViaInduction(
    const llvm::SCEVAddRecExpr* AR)

Description

Try to prove NUW on \p AR by proving facts about conditions known on entry and backedge.

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

Parameters

const llvm::SCEVAddRecExpr* AR

template <typename ExtendOpTy>
bool proveNoWrapByVaryingStart(
    const llvm::SCEV* Start,
    const llvm::SCEV* Step,
    const llvm::Loop* L)

Description

Return true if `ExtendOpTy`({`Start`,+,`Step`}) can be proved to be equal to {`ExtendOpTy`(`Start`),+,`ExtendOpTy`(`Step`)}. This is equivalent to proving no signed (resp. unsigned) wrap in {`Start`,+,`Step`} if `ExtendOpTy` is `SCEVSignExtendExpr` (resp. `SCEVZeroExtendExpr`).

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

Templates

ExtendOpTy

Parameters

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

SCEV::NoWrapFlags proveNoWrapViaConstantRanges(
    const llvm::SCEVAddRecExpr* AR)

Description

Try to prove NSW or NUW on \p AR relying on ConstantRange manipulation.

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

Parameters

const llvm::SCEVAddRecExpr* AR

void registerUser(const llvm::SCEV* User,
                  ArrayRef<const llvm::SCEV*> Ops)

Description

Notify this ScalarEvolution that \p User directly uses SCEVs in \p Ops.

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

Parameters

const llvm::SCEV* User
ArrayRef<const llvm::SCEV*> Ops

const llvm::SCEV* removePointerBase(
    const llvm::SCEV* S)

Description

Compute an expression equivalent to S - getPointerBase(S).

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

Parameters

const llvm::SCEV* S

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

Description

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

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

Parameters

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

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

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

Parameters

SCEV::NoWrapFlags Flags
SCEV::NoWrapFlags OnFlags

void setNoWrapFlags(llvm::SCEVAddRecExpr* AddRec,
                    SCEV::NoWrapFlags Flags)

Description

Update no-wrap flags of an AddRec. This may drop the cached info about this AddRec (such as range info) in case if new flags may potentially sharpen it.

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

Parameters

llvm::SCEVAddRecExpr* AddRec
SCEV::NoWrapFlags Flags

const llvm::ConstantRange& setRange(
    const llvm::SCEV* S,
    llvm::ScalarEvolution::RangeSignHint Hint,
    llvm::ConstantRange CR)

Description

Set the memoized range for the given SCEV.

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

Parameters

const llvm::SCEV* S
llvm::ScalarEvolution::RangeSignHint Hint
llvm::ConstantRange CR

bool splitBinaryAdd(const llvm::SCEV* Expr,
                    const llvm::SCEV*& L,
                    const llvm::SCEV*& R,
                    SCEV::NoWrapFlags& Flags)

Description

Try to match the Expr as "(L + R)<Flags>".

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

Parameters

const llvm::SCEV* Expr
const llvm::SCEV*& L
const llvm::SCEV*& R
SCEV::NoWrapFlags& Flags

const llvm::SCEV* stripInjectiveFunctions(
    const llvm::SCEV* Val) const

Description

Return x if \p Val is f(x) where f is a 1-1 function.

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

Parameters

const llvm::SCEV* Val

void verify() const

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

bool willNotOverflow(Instruction::BinaryOps BinOp,
                     bool Signed,
                     const llvm::SCEV* LHS,
                     const llvm::SCEV* RHS)

Description

Is operation \p BinOp between \p LHS and \p RHS provably does not have a signed/unsigned overflow (\p Signed)?

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

Parameters

Instruction::BinaryOps BinOp
bool Signed
const llvm::SCEV* LHS
const llvm::SCEV* RHS

~ScalarEvolution()

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