class LoopSafetyInfo
Declaration
class LoopSafetyInfo { /* full declaration omitted */ };
Description
Captures loop safety information. It keep information for loop blocks may throw exception or otherwise exit abnormaly on any iteration of the loop which might actually execute at runtime. The primary way to consume this infromation is via isGuaranteedToExecute below, but some callers bailout or fallback to alternate reasoning if a loop contains any implicit control flow. NOTE: LoopSafetyInfo contains cached information regarding loops and their particular blocks. This information is only dropped on invocation of computeLoopSafetyInfo. If the loop or any of its block is deleted, or if any thrower instructions have been added or removed from them, or if the control flow has changed, or in case of other meaningful modifications, the LoopSafetyInfo needs to be recomputed. If a meaningful modifications to the loop were made and the info wasn't recomputed properly, the behavior of all methods except for computeLoopSafetyInfo is undefined.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:59
Method Overview
- public LoopSafetyInfo()
- public bool allLoopPathsLeadToBlock(const llvm::Loop * CurLoop, const llvm::BasicBlock * BB, const llvm::DominatorTree * DT) const
- public virtual bool anyBlockMayThrow() const
- public virtual bool blockMayThrow(const llvm::BasicBlock * BB) const
- protected void computeBlockColors(const llvm::Loop * CurLoop)
- public virtual void computeLoopSafetyInfo(const llvm::Loop * CurLoop)
- public void copyColors(llvm::BasicBlock * New, llvm::BasicBlock * Old)
- public const DenseMap<llvm::BasicBlock *, llvm::ColorVector> & getBlockColors() const
- public virtual bool isGuaranteedToExecute(const llvm::Instruction & Inst, const llvm::DominatorTree * DT, const llvm::Loop * CurLoop) const
- public virtual ~LoopSafetyInfo()
Methods
¶LoopSafetyInfo()
LoopSafetyInfo()
Declared at: llvm/include/llvm/Analysis/MustExecute.h:100
¶bool allLoopPathsLeadToBlock(
const llvm::Loop* CurLoop,
const llvm::BasicBlock* BB,
const llvm::DominatorTree* DT) const
bool allLoopPathsLeadToBlock(
const llvm::Loop* CurLoop,
const llvm::BasicBlock* BB,
const llvm::DominatorTree* DT) const
Description
Return true if we must reach the block \p BB under assumption that the loop \p CurLoop is entered.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:84
Parameters
- const llvm::Loop* CurLoop
- const llvm::BasicBlock* BB
- const llvm::DominatorTree* DT
¶virtual bool anyBlockMayThrow() const
virtual bool anyBlockMayThrow() const
Description
Returns true iff any block of the loop for which this info is contains an instruction that may throw or otherwise exit abnormally.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:80
¶virtual bool blockMayThrow(
const llvm::BasicBlock* BB) const
virtual bool blockMayThrow(
const llvm::BasicBlock* BB) const
Description
Returns true iff the block \p BB potentially may throw exception. It can be false-positive in cases when we want to avoid complex analysis.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:76
Parameters
- const llvm::BasicBlock* BB
¶void computeBlockColors(const llvm::Loop* CurLoop)
void computeBlockColors(const llvm::Loop* CurLoop)
Description
Computes block colors.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:65
Parameters
- const llvm::Loop* CurLoop
¶virtual void computeLoopSafetyInfo(
const llvm::Loop* CurLoop)
virtual void computeLoopSafetyInfo(
const llvm::Loop* CurLoop)
Description
Computes safety information for a loop checks loop body & header for the possibility of may throw exception, it takes LoopSafetyInfo and loop as argument. Updates safety information in LoopSafetyInfo argument. Note: This is defined to clear and reinitialize an already initialized LoopSafetyInfo. Some callers rely on this fact.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:92
Parameters
- const llvm::Loop* CurLoop
¶void copyColors(llvm::BasicBlock* New,
llvm::BasicBlock* Old)
void copyColors(llvm::BasicBlock* New,
llvm::BasicBlock* Old)
Description
Copy colors of block \p Old into the block \p New.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:72
Parameters
- llvm::BasicBlock* New
- llvm::BasicBlock* Old
¶const DenseMap<llvm::BasicBlock*,
llvm::ColorVector>&
getBlockColors() const
const DenseMap<llvm::BasicBlock*,
llvm::ColorVector>&
getBlockColors() const
Description
Returns block colors map that is used to update funclet operand bundles.
Declared at: llvm/include/llvm/Analysis/MustExecute.h:69
¶virtual bool isGuaranteedToExecute(
const llvm::Instruction& Inst,
const llvm::DominatorTree* DT,
const llvm::Loop* CurLoop) const
virtual bool isGuaranteedToExecute(
const llvm::Instruction& Inst,
const llvm::DominatorTree* DT,
const llvm::Loop* CurLoop) const
Description
Returns true if the instruction in a loop is guaranteed to execute at least once (under the assumption that the loop is entered).
Declared at: llvm/include/llvm/Analysis/MustExecute.h:96
Parameters
- const llvm::Instruction& Inst
- const llvm::DominatorTree* DT
- const llvm::Loop* CurLoop
¶virtual ~LoopSafetyInfo()
virtual ~LoopSafetyInfo()
Declared at: llvm/include/llvm/Analysis/MustExecute.h:102