LLVM  10.0.0svn
Public Member Functions | List of all members
llvm::ICFLoopSafetyInfo Class Reference

This implementation of LoopSafetyInfo use ImplicitControlFlowTracking to give precise answers on "may throw" queries. More...

#include "llvm/Analysis/MustExecute.h"

Inheritance diagram for llvm::ICFLoopSafetyInfo:
Inheritance graph
[legend]
Collaboration diagram for llvm::ICFLoopSafetyInfo:
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 (under the assumption that the loop is entered). More...
 
bool doesNotWriteMemoryBefore (const BasicBlock *BB, const Loop *CurLoop) const
 Returns true if we could not execute a memory-modifying instruction before we enter BB under assumption that CurLoop is entered. More...
 
bool doesNotWriteMemoryBefore (const Instruction &I, const Loop *CurLoop) const
 Returns true if we could not execute a memory-modifying instruction before we execute I under assumption that CurLoop is entered. More...
 
void insertInstructionTo (const Instruction *Inst, const BasicBlock *BB)
 Inform the safety info that we are planning to insert a new instruction Inst into the basic block BB. More...
 
void removeInstruction (const Instruction *Inst)
 Inform safety info that we are planning to remove the instruction Inst from its block. More...
 
 ICFLoopSafetyInfo (DominatorTree *DT)
 
virtual ~ICFLoopSafetyInfo ()
 
- 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

This implementation of LoopSafetyInfo use ImplicitControlFlowTracking to give precise answers on "may throw" queries.

This implementation uses cache that should be invalidated by calling the methods insertInstructionTo and removeInstruction whenever we modify a basic block's contents by adding or removing instructions.

Definition at line 130 of file MustExecute.h.

Constructor & Destructor Documentation

◆ ICFLoopSafetyInfo()

llvm::ICFLoopSafetyInfo::ICFLoopSafetyInfo ( DominatorTree DT)
inline

Definition at line 169 of file MustExecute.h.

◆ ~ICFLoopSafetyInfo()

virtual llvm::ICFLoopSafetyInfo::~ICFLoopSafetyInfo ( )
inlinevirtual

Definition at line 171 of file MustExecute.h.

Member Function Documentation

◆ anyBlockMayThrow()

bool ICFLoopSafetyInfo::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 72 of file MustExecute.cpp.

Referenced by llvm::promoteLoopAccessesToScalars().

◆ blockMayThrow()

bool ICFLoopSafetyInfo::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 68 of file MustExecute.cpp.

◆ computeLoopSafetyInfo()

void ICFLoopSafetyInfo::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 76 of file MustExecute.cpp.

References assert(), llvm::LoopBase< BlockT, LoopT >::blocks(), and llvm::LoopSafetyInfo::computeBlockColors().

Referenced by llvm::createLICMPass().

◆ doesNotWriteMemoryBefore() [1/2]

bool ICFLoopSafetyInfo::doesNotWriteMemoryBefore ( const BasicBlock BB,
const Loop CurLoop 
) const

Returns true if we could not execute a memory-modifying instruction before we enter BB under assumption that CurLoop is entered.

Definition at line 272 of file MustExecute.cpp.

References assert(), collectTransitivePredecessors(), llvm::LoopBase< BlockT, LoopT >::contains(), and llvm::LoopBase< BlockT, LoopT >::getHeader().

Referenced by llvm::hoistRegion().

◆ doesNotWriteMemoryBefore() [2/2]

bool ICFLoopSafetyInfo::doesNotWriteMemoryBefore ( const Instruction I,
const Loop CurLoop 
) const

◆ insertInstructionTo()

void ICFLoopSafetyInfo::insertInstructionTo ( const Instruction Inst,
const BasicBlock BB 
)

Inform the safety info that we are planning to insert a new instruction Inst into the basic block BB.

It will make all cache updates to keep it correct after this insertion.

Definition at line 90 of file MustExecute.cpp.

Referenced by llvm::hoistRegion(), and moveInstructionBefore().

◆ isGuaranteedToExecute()

bool ICFLoopSafetyInfo::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 (under the assumption that the loop is entered).

Implements llvm::LoopSafetyInfo.

Definition at line 265 of file MustExecute.cpp.

References llvm::LoopSafetyInfo::allLoopPathsLeadToBlock(), and llvm::Instruction::getParent().

Referenced by hoist(), llvm::hoistRegion(), and llvm::promoteLoopAccessesToScalars().

◆ removeInstruction()

void ICFLoopSafetyInfo::removeInstruction ( const Instruction Inst)

Inform safety info that we are planning to remove the instruction Inst from its block.

It will make all cache updates to keep it correct after this removal.

Definition at line 96 of file MustExecute.cpp.

Referenced by eraseInstruction(), isSafeToExecuteUnconditionally(), and moveInstructionBefore().


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