LLVM  8.0.1
Public Member Functions | List of all members
llvm::SimpleLoopSafetyInfo Class Reference

Simple and conservative implementation of LoopSafetyInfo that can give false-positive answers to its queries in order to avoid complicated analysis. More...

#include "llvm/Analysis/MustExecute.h"

Inheritance diagram for llvm::SimpleLoopSafetyInfo:
Inheritance graph
[legend]
Collaboration diagram for llvm::SimpleLoopSafetyInfo:
Collaboration graph
[legend]

Public Member Functions

virtual bool blockMayThrow (const BasicBlock *BB) const
 Returns true iff the block BB potentially may throw exception. More...
 
virtual bool anyBlockMayThrow () const
 Returns true iff any block of the loop for which this info is contains an instruction that may throw or otherwise exit abnormally. More...
 
virtual void computeLoopSafetyInfo (const Loop *CurLoop)
 Computes safety information for a loop checks loop body & header for the possibility of may throw exception, it takes LoopSafetyInfo and loop as argument. More...
 
virtual bool isGuaranteedToExecute (const Instruction &Inst, const DominatorTree *DT, const Loop *CurLoop) const
 Returns true if the instruction in a loop is guaranteed to execute at least once. More...
 
 SimpleLoopSafetyInfo ()
 
virtual ~SimpleLoopSafetyInfo ()
 
- Public Member Functions inherited from llvm::LoopSafetyInfo
const DenseMap< BasicBlock *, ColorVector > & getBlockColors () const
 Returns block colors map that is used to update funclet operand bundles. More...
 
void copyColors (BasicBlock *New, BasicBlock *Old)
 Copy colors of block Old into the block New. More...
 
bool allLoopPathsLeadToBlock (const Loop *CurLoop, const BasicBlock *BB, const DominatorTree *DT) const
 Return true if we must reach the block BB under assumption that the loop CurLoop is entered. More...
 
 LoopSafetyInfo ()=default
 
virtual ~LoopSafetyInfo ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from llvm::LoopSafetyInfo
void computeBlockColors (const Loop *CurLoop)
 Computes block colors. More...
 

Detailed Description

Simple and conservative implementation of LoopSafetyInfo that can give false-positive answers to its queries in order to avoid complicated analysis.

Definition at line 98 of file MustExecute.h.

Constructor & Destructor Documentation

◆ SimpleLoopSafetyInfo()

llvm::SimpleLoopSafetyInfo::SimpleLoopSafetyInfo ( )
inline

Definition at line 114 of file MustExecute.h.

◆ ~SimpleLoopSafetyInfo()

virtual llvm::SimpleLoopSafetyInfo::~SimpleLoopSafetyInfo ( )
inlinevirtual

Definition at line 116 of file MustExecute.h.

Member Function Documentation

◆ anyBlockMayThrow()

bool SimpleLoopSafetyInfo::anyBlockMayThrow ( ) const
virtual

Returns true iff any block of the loop for which this info is contains an instruction that may throw or otherwise exit abnormally.

Implements llvm::LoopSafetyInfo.

Definition at line 41 of file MustExecute.cpp.

Referenced by deleteDeadInstruction(), and llvm::isSafeToUnrollAndJam().

◆ blockMayThrow()

bool SimpleLoopSafetyInfo::blockMayThrow ( const BasicBlock BB) const
virtual

Returns true iff the block BB potentially may throw exception.

It can be false-positive in cases when we want to avoid complex analysis.

Implements llvm::LoopSafetyInfo.

Definition at line 36 of file MustExecute.cpp.

References llvm::LoopSafetyInfo::anyBlockMayThrow().

◆ computeLoopSafetyInfo()

void SimpleLoopSafetyInfo::computeLoopSafetyInfo ( const Loop CurLoop)
virtual

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.

Implements llvm::LoopSafetyInfo.

Definition at line 45 of file MustExecute.cpp.

References assert(), llvm::LoopBase< BlockT, LoopT >::block_begin(), llvm::LoopBase< BlockT, LoopT >::block_end(), llvm::LoopSafetyInfo::computeBlockColors(), llvm::LoopBase< BlockT, LoopT >::getBlocks(), llvm::LoopBase< BlockT, LoopT >::getHeader(), and llvm::isGuaranteedToTransferExecutionToSuccessor().

Referenced by deleteDeadInstruction(), FindLIVLoopCondition(), isMustExecuteIn(), and llvm::isSafeToUnrollAndJam().

◆ isGuaranteedToExecute()

bool SimpleLoopSafetyInfo::isGuaranteedToExecute ( const Instruction Inst,
const DominatorTree DT,
const Loop CurLoop 
) const
virtual

Returns true if the instruction in a loop is guaranteed to execute at least once.

Implements llvm::LoopSafetyInfo.

Definition at line 235 of file MustExecute.cpp.

References llvm::LoopSafetyInfo::allLoopPathsLeadToBlock(), llvm::BasicBlock::getFirstNonPHIOrDbg(), llvm::LoopBase< BlockT, LoopT >::getHeader(), and llvm::Instruction::getParent().

Referenced by EqualityPropUnSafe(), and isMustExecuteIn().


The documentation for this class was generated from the following files: