class ScalarEvolution::BackedgeTakenInfo

Declaration

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

Description

Information about the backedge-taken count of a loop. This currently includes an exact count and a maximum count.

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

Member Variables

private SmallVector< llvm::ScalarEvolution::ExitNotTakenInfo, 1> ExitNotTaken
A list of computable exits and their not-taken counts. Loops almost never have more than one computable exit.
private const llvm::SCEV* ConstantMax = nullptr
Expression indicating the least constant maximum backedge-taken count of the loop that is known, or a SCEVCouldNotCompute. This expression is only valid if the redicates associated with all loop exits are true.
private bool IsComplete = false
Indicating if \c ExitNotTaken has an element for every exiting block in the loop.
private const llvm::SCEV* SymbolicMax = nullptr
Expression indicating the least maximum backedge-taken count of the loop that is known, or a SCEVCouldNotCompute. Lazily computed on first query.
private bool MaxOrZero = false
True iff the backedge is taken either exactly Max or zero times.

Method Overview

  • public BackedgeTakenInfo()
  • public BackedgeTakenInfo(llvm::ScalarEvolution::BackedgeTakenInfo &&)
  • public BackedgeTakenInfo(ArrayRef<llvm::ScalarEvolution::BackedgeTakenInfo::EdgeExitInfo> ExitCounts, bool IsComplete, const llvm::SCEV * ConstantMax, bool MaxOrZero)
  • private const llvm::SCEV * getConstantMax() const
  • public const llvm::SCEV * getConstantMax(llvm::ScalarEvolution * SE) const
  • public const llvm::SCEV * getConstantMax(const llvm::BasicBlock * ExitingBlock, llvm::ScalarEvolution * SE) const
  • public const llvm::SCEV * getExact(const llvm::Loop * L, llvm::ScalarEvolution * SE, SmallVector<const llvm::SCEVPredicate *, 4> * Predicates = nullptr) const
  • public const llvm::SCEV * getExact(const llvm::BasicBlock * ExitingBlock, llvm::ScalarEvolution * SE) const
  • public const llvm::SCEV * getSymbolicMax(const llvm::Loop * L, llvm::ScalarEvolution * SE)
  • public bool hasAnyInfo() const
  • public bool hasFullInfo() const
  • private bool isComplete() const
  • public bool isConstantMaxOrZero(llvm::ScalarEvolution * SE) const

Methods

BackedgeTakenInfo()

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

BackedgeTakenInfo(
    llvm::ScalarEvolution::BackedgeTakenInfo&&)

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

Parameters

llvm::ScalarEvolution::BackedgeTakenInfo&&

BackedgeTakenInfo(
    ArrayRef<llvm::ScalarEvolution::
                 BackedgeTakenInfo::EdgeExitInfo>
        ExitCounts,
    bool IsComplete,
    const llvm::SCEV* ConstantMax,
    bool MaxOrZero)

Description

Initialize BackedgeTakenInfo from a list of exact exit counts.

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

Parameters

ArrayRef<llvm::ScalarEvolution:: BackedgeTakenInfo::EdgeExitInfo> ExitCounts
bool IsComplete
const llvm::SCEV* ConstantMax
bool MaxOrZero

const llvm::SCEV* getConstantMax() const

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

const llvm::SCEV* getConstantMax(
    llvm::ScalarEvolution* SE) const

Description

Get the constant max backedge taken count for the loop.

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

Parameters

llvm::ScalarEvolution* SE

const llvm::SCEV* getConstantMax(
    const llvm::BasicBlock* ExitingBlock,
    llvm::ScalarEvolution* SE) const

Description

Get the constant max backedge taken count for the particular loop exit.

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

Parameters

const llvm::BasicBlock* ExitingBlock
llvm::ScalarEvolution* SE

const llvm::SCEV* getExact(
    const llvm::Loop* L,
    llvm::ScalarEvolution* SE,
    SmallVector<const llvm::SCEVPredicate*, 4>*
        Predicates = nullptr) const

Description

Return an expression indicating the exact *backedge-taken* count of the loop if it is known or SCEVCouldNotCompute otherwise. If execution makes it to the backedge on every iteration (i.e. there are no abnormal exists like exception throws and thread exits) then this is the number of times the loop header will execute minus one. If the SCEV predicate associated with the answer can be different from AlwaysTrue, we must add a (non null) Predicates argument. The SCEV predicate associated with the answer will be added to Predicates. A run-time check needs to be emitted for the SCEV predicate in order for the answer to be valid. Note that we should always know if we need to pass a predicate argument or not from the way the ExitCounts vector was computed. If we allowed SCEV predicates to be generated when populating this vector, this information can contain them and therefore a SCEVPredicate argument should be added to getExact.

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

Parameters

const llvm::Loop* L
llvm::ScalarEvolution* SE
SmallVector<const llvm::SCEVPredicate*, 4>* Predicates = nullptr

const llvm::SCEV* getExact(
    const llvm::BasicBlock* ExitingBlock,
    llvm::ScalarEvolution* SE) const

Description

Return the number of times this loop exit may fall through to the back edge, or SCEVCouldNotCompute. The loop is guaranteed not to exit via this block before this number of iterations, but may exit via another block.

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

Parameters

const llvm::BasicBlock* ExitingBlock
llvm::ScalarEvolution* SE

const llvm::SCEV* getSymbolicMax(
    const llvm::Loop* L,
    llvm::ScalarEvolution* SE)

Description

Get the symbolic max backedge taken count for the loop.

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

Parameters

const llvm::Loop* L
llvm::ScalarEvolution* SE

bool hasAnyInfo() const

Description

Test whether this BackedgeTakenInfo contains any computed information, or whether it's all SCEVCouldNotCompute values.

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

bool hasFullInfo() const

Description

Test whether this BackedgeTakenInfo contains complete information.

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

bool isComplete() const

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

bool isConstantMaxOrZero(
    llvm::ScalarEvolution* SE) const

Description

Return true if the number of times this backedge is taken is either the value returned by getConstantMax or zero.

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

Parameters

llvm::ScalarEvolution* SE