LLVM 20.0.0git
|
Holds information about the memory runtime legality checks to verify that a group of pointers do not overlap. More...
#include "llvm/Analysis/LoopAccessAnalysis.h"
Classes | |
struct | PointerInfo |
Public Member Functions | |
RuntimePointerChecking (MemoryDepChecker &DC, ScalarEvolution *SE) | |
void | reset () |
Reset the state of the pointer runtime information. | |
void | insert (Loop *Lp, Value *Ptr, const SCEV *PtrExpr, Type *AccessTy, bool WritePtr, unsigned DepSetId, unsigned ASId, PredicatedScalarEvolution &PSE, bool NeedsFreeze) |
Insert a pointer and calculate the start and end SCEVs. | |
bool | empty () const |
No run-time memory checking is necessary. | |
void | generateChecks (MemoryDepChecker::DepCandidates &DepCands, bool UseDependencies) |
Generate the checks and store it. | |
const SmallVectorImpl< RuntimePointerCheck > & | getChecks () const |
Returns the checks that generateChecks created. | |
std::optional< ArrayRef< PointerDiffInfo > > | getDiffChecks () const |
bool | needsChecking (const RuntimeCheckingPtrGroup &M, const RuntimeCheckingPtrGroup &N) const |
Decide if we need to add a check between two groups of pointers, according to needsChecking. | |
unsigned | getNumberOfChecks () const |
Returns the number of run-time checks required according to needsChecking. | |
void | print (raw_ostream &OS, unsigned Depth=0) const |
Print the list run-time memory checks necessary. | |
void | printChecks (raw_ostream &OS, const SmallVectorImpl< RuntimePointerCheck > &Checks, unsigned Depth=0) const |
Print Checks . | |
bool | needsChecking (unsigned I, unsigned J) const |
Decide whether we need to issue a run-time check for pointer at index I and J to prove their independence. | |
const PointerInfo & | getPointerInfo (unsigned PtrIdx) const |
Return PointerInfo for pointer at index PtrIdx . | |
ScalarEvolution * | getSE () const |
Static Public Member Functions | |
static bool | arePointersInSamePartition (const SmallVectorImpl< int > &PtrToPartition, unsigned PtrIdx1, unsigned PtrIdx2) |
Check if pointers are in the same partition. | |
Public Attributes | |
bool | Need = false |
This flag indicates if we need to add the runtime check. | |
SmallVector< PointerInfo, 2 > | Pointers |
Information about the pointers that may require checking. | |
SmallVector< RuntimeCheckingPtrGroup, 2 > | CheckingGroups |
Holds a partitioning of pointers into "check groups". | |
Friends | |
struct | RuntimeCheckingPtrGroup |
Holds information about the memory runtime legality checks to verify that a group of pointers do not overlap.
Definition at line 447 of file LoopAccessAnalysis.h.
|
inline |
Definition at line 480 of file LoopAccessAnalysis.h.
|
static |
Check if pointers are in the same partition.
PtrToPartition
contains the partition number for pointers (-1 if the pointer belongs to multiple partitions).
Definition at line 584 of file LoopAccessAnalysis.cpp.
|
inline |
No run-time memory checking is necessary.
Definition at line 502 of file LoopAccessAnalysis.h.
References Pointers.
void RuntimePointerChecking::generateChecks | ( | MemoryDepChecker::DepCandidates & | DepCands, |
bool | UseDependencies | ||
) |
Generate the checks and store it.
This also performs the grouping of pointers to reduce the number of memchecks necessary.
Definition at line 395 of file LoopAccessAnalysis.cpp.
References assert(), llvm::SmallVectorBase< Size_T >::empty(), and generateChecks().
Referenced by generateChecks().
|
inline |
Returns the checks that generateChecks created.
They can be used to ensure no read/write accesses overlap across all loop iterations.
Definition at line 511 of file LoopAccessAnalysis.h.
Referenced by llvm::LoopVectorizationPlanner::executePlan().
|
inline |
Definition at line 520 of file LoopAccessAnalysis.h.
Referenced by llvm::LoopVectorizationPlanner::executePlan().
|
inline |
Returns the number of run-time checks required according to needsChecking.
Definition at line 533 of file LoopAccessAnalysis.h.
References llvm::SmallVectorBase< Size_T >::size().
|
inline |
Return PointerInfo for pointer at index PtrIdx
.
Definition at line 565 of file LoopAccessAnalysis.h.
References Pointers.
Referenced by llvm::LoopVersioning::prepareNoAliasMetadata().
|
inline |
Definition at line 569 of file LoopAccessAnalysis.h.
void RuntimePointerChecking::insert | ( | Loop * | Lp, |
Value * | Ptr, | ||
const SCEV * | PtrExpr, | ||
Type * | AccessTy, | ||
bool | WritePtr, | ||
unsigned | DepSetId, | ||
unsigned | ASId, | ||
PredicatedScalarEvolution & | PSE, | ||
bool | NeedsFreeze | ||
) |
Insert a pointer and calculate the start and end SCEVs.
Calculate Start and End points of memory access using getStartAndEndForAccess.
We need 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 Strides
, and add new predicates to PSE
.
Definition at line 261 of file LoopAccessAnalysis.cpp.
References assert(), llvm::MemoryDepChecker::getPointerBounds(), getStartAndEndForAccess(), Pointers, and Ptr.
bool RuntimePointerChecking::needsChecking | ( | const RuntimeCheckingPtrGroup & | M, |
const RuntimeCheckingPtrGroup & | N | ||
) | const |
Decide if we need to add a check between two groups of pointers, according to needsChecking.
Definition at line 402 of file LoopAccessAnalysis.cpp.
References I, N, and needsChecking().
Referenced by needsChecking().
Decide whether we need to issue a run-time check for pointer at index I
and J
to prove their independence.
Definition at line 591 of file LoopAccessAnalysis.cpp.
References llvm::RuntimePointerChecking::PointerInfo::AliasSetId, llvm::RuntimePointerChecking::PointerInfo::DependencySetId, I, llvm::RuntimePointerChecking::PointerInfo::IsWritePtr, and Pointers.
void RuntimePointerChecking::print | ( | raw_ostream & | OS, |
unsigned | Depth = 0 |
||
) | const |
Print the list run-time memory checks necessary.
Definition at line 626 of file LoopAccessAnalysis.cpp.
References CheckingGroups, llvm::Depth, llvm::raw_ostream::indent(), OS, Pointers, and printChecks().
void RuntimePointerChecking::printChecks | ( | raw_ostream & | OS, |
const SmallVectorImpl< RuntimePointerCheck > & | Checks, | ||
unsigned | Depth = 0 |
||
) | const |
Print Checks
.
Definition at line 607 of file LoopAccessAnalysis.cpp.
References llvm::Depth, llvm::First, llvm::raw_ostream::indent(), N, OS, and Pointers.
Referenced by print().
|
inline |
Reset the state of the pointer runtime information.
Definition at line 484 of file LoopAccessAnalysis.h.
References llvm::SmallVectorImpl< T >::clear(), Need, and Pointers.
|
friend |
Definition at line 448 of file LoopAccessAnalysis.h.
SmallVector<RuntimeCheckingPtrGroup, 2> llvm::RuntimePointerChecking::CheckingGroups |
Holds a partitioning of pointers into "check groups".
Definition at line 550 of file LoopAccessAnalysis.h.
Referenced by llvm::LoopVersioning::prepareNoAliasMetadata(), and print().
bool llvm::RuntimePointerChecking::Need = false |
This flag indicates if we need to add the runtime check.
Definition at line 544 of file LoopAccessAnalysis.h.
Referenced by llvm::LoopVectorizationLegality::canVectorize(), llvm::LoopVectorizationCostModel::computeMaxVF(), reset(), llvm::LoopVectorizationCostModel::runtimeChecksRequired(), and llvm::LoopVectorizationCostModel::selectInterleaveCount().
SmallVector<PointerInfo, 2> llvm::RuntimePointerChecking::Pointers |
Information about the pointers that may require checking.
Definition at line 547 of file LoopAccessAnalysis.h.
Referenced by llvm::RuntimeCheckingPtrGroup::addPointer(), empty(), getPointerInfo(), insert(), needsChecking(), print(), printChecks(), and reset().