class RuntimePointerChecking

Declaration

class RuntimePointerChecking { /* full declaration omitted */ };

Description

Holds information about the memory runtime legality checks to verify that a group of pointers do not overlap.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:384

Member Variables

public bool Need = false
This flag indicates if we need to add the runtime check.
public SmallVector< llvm::RuntimePointerChecking::PointerInfo, 2> Pointers
Information about the pointers that may require checking.
public SmallVector<llvm::RuntimeCheckingPtrGroup, 2> CheckingGroups
Holds a partitioning of pointers into "check groups".
private llvm::MemoryDepChecker& DC
private llvm::ScalarEvolution* SE
Holds a pointer to the ScalarEvolution analysis.
private SmallVector<llvm::RuntimePointerCheck, 4> Checks
Set of run-time checks required to establish independence of otherwise may-aliasing pointers in the loop.
private bool CanUseDiffCheck = true
Flag indicating if pointer-difference checks can be used
private SmallVector<llvm::PointerDiffInfo> DiffChecks
A list of (pointer-difference, access size) pairs that can be used to prove that there are no vectorization-preventing dependencies.

Method Overview

  • public RuntimePointerChecking(llvm::MemoryDepChecker & DC, llvm::ScalarEvolution * SE)
  • public static bool arePointersInSamePartition(const SmallVectorImpl<int> & PtrToPartition, unsigned int PtrIdx1, unsigned int PtrIdx2)
  • public bool empty() const
  • private SmallVector<llvm::RuntimePointerCheck, 4> generateChecks()
  • public void generateChecks(MemoryDepChecker::DepCandidates & DepCands, bool UseDependencies)
  • public const SmallVectorImpl<llvm::RuntimePointerCheck> & getChecks() const
  • public Optional<ArrayRef<llvm::PointerDiffInfo>> getDiffChecks() const
  • public unsigned int getNumberOfChecks() const
  • public const llvm::RuntimePointerChecking::PointerInfo & getPointerInfo(unsigned int PtrIdx) const
  • public llvm::ScalarEvolution * getSE() const
  • private void groupChecks(MemoryDepChecker::DepCandidates & DepCands, bool UseDependencies)
  • public void insert(llvm::Loop * Lp, llvm::Value * Ptr, const llvm::SCEV * PtrExpr, llvm::Type * AccessTy, bool WritePtr, unsigned int DepSetId, unsigned int ASId, llvm::PredicatedScalarEvolution & PSE, bool NeedsFreeze)
  • public bool needsChecking(const llvm::RuntimeCheckingPtrGroup & M, const llvm::RuntimeCheckingPtrGroup & N) const
  • public bool needsChecking(unsigned int I, unsigned int J) const
  • public void print(llvm::raw_ostream & OS, unsigned int Depth = 0) const
  • public void printChecks(llvm::raw_ostream & OS, const SmallVectorImpl<llvm::RuntimePointerCheck> & Checks, unsigned int Depth = 0) const
  • public void reset()
  • private void tryToCreateDiffCheck(const llvm::RuntimeCheckingPtrGroup & CGI, const llvm::RuntimeCheckingPtrGroup & CGJ)

Methods

RuntimePointerChecking(llvm::MemoryDepChecker& DC,
                       llvm::ScalarEvolution* SE)

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:417

Parameters

llvm::MemoryDepChecker& DC
llvm::ScalarEvolution* SE

static bool arePointersInSamePartition(
    const SmallVectorImpl<int>& PtrToPartition,
    unsigned int PtrIdx1,
    unsigned int PtrIdx2)

Description

Check if pointers are in the same partition \p PtrToPartition contains the partition number for pointers (-1 if the pointer belongs to multiple partitions).

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:492

Parameters

const SmallVectorImpl<int>& PtrToPartition
unsigned int PtrIdx1
unsigned int PtrIdx2

bool empty() const

Description

No run-time memory checking is necessary.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:437

SmallVector<llvm::RuntimePointerCheck, 4>
generateChecks()

Description

Generate the checks and return them.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:515

void generateChecks(
    MemoryDepChecker::DepCandidates& DepCands,
    bool UseDependencies)

Description

Generate the checks and store it. This also performs the grouping of pointers to reduce the number of memchecks necessary.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:441

Parameters

MemoryDepChecker::DepCandidates& DepCands
bool UseDependencies

const SmallVectorImpl<llvm::RuntimePointerCheck>&
getChecks() const

Description

Returns the checks that generateChecks created. They can be used to ensure no read/write accesses overlap across all loop iterations.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:446

Optional<ArrayRef<llvm::PointerDiffInfo>>
getDiffChecks() const

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:455

unsigned int getNumberOfChecks() const

Description

Returns the number of run-time checks required according to needsChecking.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:468

const llvm::RuntimePointerChecking::PointerInfo&
getPointerInfo(unsigned int PtrIdx) const

Description

Return PointerInfo for pointer at index \p PtrIdx.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:500

Parameters

unsigned int PtrIdx

llvm::ScalarEvolution* getSE() const

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:504

void groupChecks(
    MemoryDepChecker::DepCandidates& DepCands,
    bool UseDependencies)

Description

Groups pointers such that a single memcheck is required between two different groups. This will clear the CheckingGroups vector and re-compute it. We will only group dependecies if \p UseDependencies is true, otherwise we will create a separate group for each pointer.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:511

Parameters

MemoryDepChecker::DepCandidates& DepCands
bool UseDependencies

void insert(llvm::Loop* Lp,
            llvm::Value* Ptr,
            const llvm::SCEV* PtrExpr,
            llvm::Type* AccessTy,
            bool WritePtr,
            unsigned int DepSetId,
            unsigned int ASId,
            llvm::PredicatedScalarEvolution& PSE,
            bool NeedsFreeze)

Description

Insert a pointer and calculate the start and end SCEVs. We need \p PSE in order to compute the SCEV expression of the pointer according to the assumptions that we've made during the analysis. The method might also version the pointer stride according to \p Strides, and add new predicates to \p PSE.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:432

Parameters

llvm::Loop* Lp
llvm::Value* Ptr
const llvm::SCEV* PtrExpr
llvm::Type* AccessTy
bool WritePtr
unsigned int DepSetId
unsigned int ASId
llvm::PredicatedScalarEvolution& PSE
bool NeedsFreeze

bool needsChecking(
    const llvm::RuntimeCheckingPtrGroup& M,
    const llvm::RuntimeCheckingPtrGroup& N) const

Description

Decide if we need to add a check between two groups of pointers, according to needsChecking.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:463

Parameters

const llvm::RuntimeCheckingPtrGroup& M
const llvm::RuntimeCheckingPtrGroup& N

bool needsChecking(unsigned int I,
                   unsigned int J) const

Description

Decide whether we need to issue a run-time check for pointer at index \p I and \p J to prove their independence.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:497

Parameters

unsigned int I
unsigned int J

void print(llvm::raw_ostream& OS,
           unsigned int Depth = 0) const

Description

Print the list run-time memory checks necessary.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:471

Parameters

llvm::raw_ostream& OS
unsigned int Depth = 0

void printChecks(
    llvm::raw_ostream& OS,
    const SmallVectorImpl<
        llvm::RuntimePointerCheck>& Checks,
    unsigned int Depth = 0) const

Description

Print \p Checks.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:474

Parameters

llvm::raw_ostream& OS
const SmallVectorImpl<llvm::RuntimePointerCheck>& Checks
unsigned int Depth = 0

void reset()

Description

Reset the state of the pointer runtime information.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:421

void tryToCreateDiffCheck(
    const llvm::RuntimeCheckingPtrGroup& CGI,
    const llvm::RuntimeCheckingPtrGroup& CGJ)

Description

Try to create add a new (pointer-difference, access size) pair to DiffCheck for checking groups \p CGI and \p CGJ. If pointer-difference checks cannot be used for the groups, set CanUseDiffCheck to false.

Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:520

Parameters

const llvm::RuntimeCheckingPtrGroup& CGI
const llvm::RuntimeCheckingPtrGroup& CGJ