class ICFLoopSafetyInfo

Declaration

class ICFLoopSafetyInfo : public LoopSafetyInfo { /* full declaration omitted */ };

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.

Declared at: llvm/include/llvm/Analysis/MustExecute.h:132

Inherits from: LoopSafetyInfo

Member Variables

private bool MayThrow = false
private llvm::ImplicitControlFlowTracking ICF
private llvm::MemoryWriteTracking MW

Method Overview

Inherited from LoopSafetyInfo:

Methods

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:143

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:141

Parameters

const llvm::BasicBlock* BB

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:145

Parameters

const llvm::Loop* CurLoop

bool doesNotWriteMemoryBefore(
    const llvm::BasicBlock* BB,
    const llvm::Loop* CurLoop) const

Description

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

Declared at: llvm/include/llvm/Analysis/MustExecute.h:153

Parameters

const llvm::BasicBlock* BB
const llvm::Loop* CurLoop

bool doesNotWriteMemoryBefore(
    const llvm::Instruction& I,
    const llvm::Loop* CurLoop) const

Description

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

Declared at: llvm/include/llvm/Analysis/MustExecute.h:158

Parameters

const llvm::Instruction& I
const llvm::Loop* CurLoop

void insertInstructionTo(
    const llvm::Instruction* Inst,
    const llvm::BasicBlock* BB)

Description

Inform the safety info that we are planning to insert a new instruction\p Inst into the basic block \p BB. It will make all cache updates to keep it correct after this insertion.

Declared at: llvm/include/llvm/Analysis/MustExecute.h:164

Parameters

const llvm::Instruction* Inst
const llvm::BasicBlock* BB

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:147

Parameters

const llvm::Instruction& Inst
const llvm::DominatorTree* DT
const llvm::Loop* CurLoop

void removeInstruction(
    const llvm::Instruction* Inst)

Description

Inform safety info that we are planning to remove the instruction \p Inst from its block. It will make all cache updates to keep it correct after this removal.

Declared at: llvm/include/llvm/Analysis/MustExecute.h:169

Parameters

const llvm::Instruction* Inst