|
LLVM 24.0.0git
|
Captures loop safety information. More...
#include "llvm/Analysis/MustExecute.h"
Public Member Functions | |
| LLVM_ABI const DenseMap< BasicBlock *, ColorVector > & | getBlockColors () const |
| Returns block colors map that is used to update funclet operand bundles. | |
| LLVM_ABI void | copyColors (BasicBlock *New, BasicBlock *Old) |
Copy colors of block Old into the block New. | |
| virtual bool | blockMayThrow (const BasicBlock *BB) const =0 |
Returns true iff the block BB potentially may throw exception. | |
| virtual bool | anyBlockMayThrow () const =0 |
| Returns true iff any block of the loop for which this info is contains an instruction that may throw or otherwise exit abnormally. | |
| LLVM_ABI bool | allLoopPathsLeadToBlock (const BasicBlock *BB, const DominatorTree *DT) const |
Return true if we must reach the block BB under assumption that the loop is entered. | |
| virtual bool | isGuaranteedToExecute (const Instruction &Inst, const DominatorTree *DT) const =0 |
| Returns true if the instruction in a loop is guaranteed to execute at least once (under the assumption that the loop is entered). | |
| LoopSafetyInfo (const Loop *CurLoop) | |
| virtual | ~LoopSafetyInfo ()=default |
Protected Member Functions | |
| LLVM_ABI void | computeBlockColors () |
| Computes block colors. | |
Protected Attributes | |
| const Loop * | CurLoop |
Captures loop safety information.
It keep information for loop blocks may throw exception or otherwise exit abnormally on any iteration of the loop which might actually execute at runtime. The primary way to consume this information 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. Cached information may not be valid after control flow changes.
Definition at line 55 of file MustExecute.h.
Definition at line 97 of file MustExecute.h.
References CurLoop.
Referenced by llvm::ICFLoopSafetyInfo::ICFLoopSafetyInfo(), and llvm::SimpleLoopSafetyInfo::SimpleLoopSafetyInfo().
|
virtualdefault |
| bool LoopSafetyInfo::allLoopPathsLeadToBlock | ( | const BasicBlock * | BB, |
| const DominatorTree * | DT ) const |
Return true if we must reach the block BB under assumption that the loop is entered.
Definition at line 198 of file MustExecute.cpp.
References assert(), and CurLoop.
Referenced by llvm::ICFLoopSafetyInfo::isGuaranteedToExecute(), and llvm::SimpleLoopSafetyInfo::isGuaranteedToExecute().
|
pure virtual |
Returns true iff any block of the loop for which this info is contains an instruction that may throw or otherwise exit abnormally.
Implemented in llvm::ICFLoopSafetyInfo, and llvm::SimpleLoopSafetyInfo.
References LLVM_ABI.
|
pure 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.
Implemented in llvm::ICFLoopSafetyInfo, and llvm::SimpleLoopSafetyInfo.
|
protected |
Computes block colors.
Definition at line 102 of file MustExecute.cpp.
References llvm::classifyEHPersonality(), llvm::colorEHFunclets(), CurLoop, llvm::Function::getPersonalityFn(), llvm::Function::hasPersonalityFn(), and llvm::isScopedEHPersonality().
| void LoopSafetyInfo::copyColors | ( | BasicBlock * | New, |
| BasicBlock * | Old ) |
Copy colors of block Old into the block New.
Definition at line 34 of file MustExecute.cpp.
Referenced by splitPredecessorsOfLoopExit().
| const DenseMap< BasicBlock *, ColorVector > & LoopSafetyInfo::getBlockColors | ( | ) | const |
Returns block colors map that is used to update funclet operand bundles.
Definition at line 30 of file MustExecute.cpp.
Referenced by canSplitPredecessors(), cloneInstructionInExitBlock(), isNotUsedOrFoldableInLoop(), and splitPredecessorsOfLoopExit().
|
pure virtual |
Returns true if the instruction in a loop is guaranteed to execute at least once (under the assumption that the loop is entered).
Implemented in llvm::ICFLoopSafetyInfo, and llvm::SimpleLoopSafetyInfo.
Referenced by isSafeToExecuteUnconditionally().
Definition at line 67 of file MustExecute.h.
Referenced by allLoopPathsLeadToBlock(), computeBlockColors(), llvm::ICFLoopSafetyInfo::doesNotWriteMemoryBefore(), llvm::ICFLoopSafetyInfo::doesNotWriteMemoryBefore(), llvm::SimpleLoopSafetyInfo::isGuaranteedToExecute(), and LoopSafetyInfo().