LLVM  3.7.0
Classes | Public Types | Public Member Functions | List of all members
llvm::MemoryDepChecker Class Reference

Checks memory dependences among accesses to the same underlying object to determine whether there vectorization is legal or not (and at which vectorization factor). More...

#include <LoopAccessAnalysis.h>

Classes

struct  Dependence
 Dependece between memory access instructions. More...
 

Public Types

typedef PointerIntPair< Value
*, 1, bool
MemAccessInfo
 
typedef SmallPtrSet
< MemAccessInfo, 8 > 
MemAccessInfoSet
 
typedef EquivalenceClasses
< MemAccessInfo
DepCandidates
 Set of potential dependent memory accesses. More...
 

Public Member Functions

 MemoryDepChecker (ScalarEvolution *Se, const Loop *L)
 
void addAccess (StoreInst *SI)
 Register the location (instructions are given increasing numbers) of a write access. More...
 
void addAccess (LoadInst *LI)
 Register the location (instructions are given increasing numbers) of a write access. More...
 
bool areDepsSafe (DepCandidates &AccessSets, MemAccessInfoSet &CheckDeps, const ValueToValueMap &Strides)
 Check whether the dependencies between the accesses are safe. More...
 
bool isSafeForVectorization () const
 No memory dependence was encountered that would inhibit vectorization. More...
 
unsigned getMaxSafeDepDistBytes ()
 The maximum number of bytes of a vector register we can vectorize the accesses safely with. More...
 
bool shouldRetryWithRuntimeCheck ()
 In same cases when the dependency check fails we can still vectorize the loop with a dynamic array access check. More...
 
const SmallVectorImpl
< Dependence > * 
getInterestingDependences () const
 Returns the interesting dependences. More...
 
void clearInterestingDependences ()
 
const SmallVectorImpl
< Instruction * > & 
getMemoryInstructions () const
 The vector of memory access instructions. More...
 
SmallVector< Instruction *, 4 > getInstructionsForAccess (Value *Ptr, bool isWrite) const
 Find the set of instructions that read or write via Ptr. More...
 

Detailed Description

Checks memory dependences among accesses to the same underlying object to determine whether there vectorization is legal or not (and at which vectorization factor).

Note: This class will compute a conservative dependence for access to different underlying pointers. Clients, such as the loop vectorizer, will sometimes deal these potential dependencies by emitting runtime checks.

We use the ScalarEvolution framework to symbolically evalutate access functions pairs. Since we currently don't restructure the loop we can rely on the program order of memory accesses to determine their safety. At the moment we will only deem accesses as safe for:

Definition at line 123 of file LoopAccessAnalysis.h.

Member Typedef Documentation

Set of potential dependent memory accesses.

Definition at line 128 of file LoopAccessAnalysis.h.

Definition at line 125 of file LoopAccessAnalysis.h.

Definition at line 126 of file LoopAccessAnalysis.h.

Constructor & Destructor Documentation

llvm::MemoryDepChecker::MemoryDepChecker ( ScalarEvolution Se,
const Loop L 
)
inline

Definition at line 180 of file LoopAccessAnalysis.h.

Member Function Documentation

void llvm::MemoryDepChecker::addAccess ( StoreInst SI)
inline

Register the location (instructions are given increasing numbers) of a write access.

Definition at line 187 of file LoopAccessAnalysis.h.

References llvm::StoreInst::getPointerOperand().

void llvm::MemoryDepChecker::addAccess ( LoadInst LI)
inline

Register the location (instructions are given increasing numbers) of a write access.

Definition at line 196 of file LoopAccessAnalysis.h.

References llvm::LoadInst::getPointerOperand().

bool MemoryDepChecker::areDepsSafe ( DepCandidates AccessSets,
MemAccessInfoSet CheckDeps,
const ValueToValueMap Strides 
)
void llvm::MemoryDepChecker::clearInterestingDependences ( )
inline

Definition at line 228 of file LoopAccessAnalysis.h.

SmallVector< Instruction *, 4 > MemoryDepChecker::getInstructionsForAccess ( Value Ptr,
bool  isWrite 
) const

Find the set of instructions that read or write via Ptr.

Definition at line 1236 of file LoopAccessAnalysis.cpp.

Referenced by llvm::LoopAccessInfo::getInstructionsForAccess().

const SmallVectorImpl<Dependence>* llvm::MemoryDepChecker::getInterestingDependences ( ) const
inline

Returns the interesting dependences.

If null is returned we exceeded the MaxInterestingDependence threshold and this information is not available.

Definition at line 224 of file LoopAccessAnalysis.h.

Referenced by llvm::LoopAccessInfo::print().

unsigned llvm::MemoryDepChecker::getMaxSafeDepDistBytes ( )
inline

The maximum number of bytes of a vector register we can vectorize the accesses safely with.

Definition at line 215 of file LoopAccessAnalysis.h.

const SmallVectorImpl<Instruction *>& llvm::MemoryDepChecker::getMemoryInstructions ( ) const
inline

The vector of memory access instructions.

The indices are used as instruction identifiers in the Dependence class.

Definition at line 232 of file LoopAccessAnalysis.h.

Referenced by llvm::LoopAccessInfo::print().

bool llvm::MemoryDepChecker::isSafeForVectorization ( ) const
inline

No memory dependence was encountered that would inhibit vectorization.

Definition at line 211 of file LoopAccessAnalysis.h.

bool llvm::MemoryDepChecker::shouldRetryWithRuntimeCheck ( )
inline

In same cases when the dependency check fails we can still vectorize the loop with a dynamic array access check.

Definition at line 219 of file LoopAccessAnalysis.h.


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