LLVM  3.7.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
llvm::LoopAccessInfo Class Reference

Drive the analysis of memory accesses in the loop. More...

#include <LoopAccessAnalysis.h>

Collaboration diagram for llvm::LoopAccessInfo:
[legend]

Public Member Functions

 LoopAccessInfo (Loop *L, ScalarEvolution *SE, const DataLayout &DL, const TargetLibraryInfo *TLI, AliasAnalysis *AA, DominatorTree *DT, LoopInfo *LI, const ValueToValueMap &Strides)
 
bool canVectorizeMemory () const
 Return true we can analyze the memory accesses in the loop and there are no memory dependence cycles. More...
 
const RuntimePointerCheckinggetRuntimePointerChecking () const
 
unsigned getNumRuntimePointerChecks (const SmallVectorImpl< int > *PtrPartition=nullptr) const
 Number of memchecks required to prove independence of otherwise may-alias pointers. More...
 
bool isUniform (Value *V) const
 Returns true if the value V is uniform within the loop. More...
 
unsigned getMaxSafeDepDistBytes () const
 
unsigned getNumStores () const
 
unsigned getNumLoads () const
 
std::pair< Instruction
*, Instruction * > 
addRuntimeCheck (Instruction *Loc, const SmallVectorImpl< int > *PtrPartition=nullptr) const
 Add code that checks at runtime if the accessed arrays overlap. More...
 
const Optional
< LoopAccessReport > & 
getReport () const
 The diagnostics report generated for the analysis. More...
 
const MemoryDepCheckergetDepChecker () const
 the Memory Dependence Checker which can determine the loop-independent and loop-carried dependences between memory accesses. More...
 
SmallVector< Instruction *, 4 > getInstructionsForAccess (Value *Ptr, bool isWrite) const
 Return the list of instructions that use Ptr to read or write memory. More...
 
void print (raw_ostream &OS, unsigned Depth=0) const
 Print the information about the memory accesses in the loop. More...
 
bool hasStoreToLoopInvariantAddress () const
 Checks existence of store to invariant address inside loop. More...
 

Static Public Member Functions

static bool blockNeedsPredication (BasicBlock *BB, Loop *TheLoop, DominatorTree *DT)
 Return true if the block BB needs to be predicated in order for the loop to be vectorized. More...
 

Public Attributes

unsigned NumSymbolicStrides
 Used to ensure that if the analysis was run with speculating the value of symbolic strides, the client queries it with the same assumption. More...
 

Detailed Description

Drive the analysis of memory accesses in the loop.

This class is responsible for analyzing the memory accesses of a loop. It collects the accesses and then its main helper the AccessAnalysis class finds and categorizes the dependences in buildDependenceSets.

For memory dependences that can be analyzed at compile time, it determines whether the dependence is part of cycle inhibiting vectorization. This work is delegated to the MemoryDepChecker class.

For memory dependences that cannot be determined at compile time, it generates run-time checks to prove independence. This is done by AccessAnalysis::canCheckPtrAtRT and the checks are maintained by the RuntimePointerCheck class.

Definition at line 436 of file LoopAccessAnalysis.h.

Constructor & Destructor Documentation

LoopAccessInfo::LoopAccessInfo ( Loop L,
ScalarEvolution SE,
const DataLayout DL,
const TargetLibraryInfo TLI,
AliasAnalysis AA,
DominatorTree DT,
LoopInfo LI,
const ValueToValueMap Strides 
)

Definition at line 1664 of file LoopAccessAnalysis.cpp.

Member Function Documentation

std::pair< Instruction *, Instruction * > LoopAccessInfo::addRuntimeCheck ( Instruction Loc,
const SmallVectorImpl< int > *  PtrPartition = nullptr 
) const
bool LoopAccessInfo::blockNeedsPredication ( BasicBlock BB,
Loop TheLoop,
DominatorTree DT 
)
static

Return true if the block BB needs to be predicated in order for the loop to be vectorized.

Definition at line 1540 of file LoopAccessAnalysis.cpp.

References llvm::LoopBase< N, M >::contains(), llvm::DominatorTree::dominates(), and llvm::LoopBase< N, M >::getLoopLatch().

bool llvm::LoopAccessInfo::canVectorizeMemory ( ) const
inline

Return true we can analyze the memory accesses in the loop and there are no memory dependence cycles.

Definition at line 445 of file LoopAccessAnalysis.h.

const MemoryDepChecker& llvm::LoopAccessInfo::getDepChecker ( ) const
inline

the Memory Dependence Checker which can determine the loop-independent and loop-carried dependences between memory accesses.

Definition at line 489 of file LoopAccessAnalysis.h.

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

Return the list of instructions that use Ptr to read or write memory.

Definition at line 493 of file LoopAccessAnalysis.h.

References llvm::MemoryDepChecker::getInstructionsForAccess().

unsigned llvm::LoopAccessInfo::getMaxSafeDepDistBytes ( ) const
inline

Definition at line 466 of file LoopAccessAnalysis.h.

unsigned llvm::LoopAccessInfo::getNumLoads ( ) const
inline

Definition at line 468 of file LoopAccessAnalysis.h.

unsigned llvm::LoopAccessInfo::getNumRuntimePointerChecks ( const SmallVectorImpl< int > *  PtrPartition = nullptr) const
inline

Number of memchecks required to prove independence of otherwise may-alias pointers.

Definition at line 453 of file LoopAccessAnalysis.h.

References llvm::RuntimePointerChecking::getNumberOfChecks().

unsigned llvm::LoopAccessInfo::getNumStores ( ) const
inline

Definition at line 467 of file LoopAccessAnalysis.h.

const Optional<LoopAccessReport>& llvm::LoopAccessInfo::getReport ( ) const
inline

The diagnostics report generated for the analysis.

E.g. why we couldn't analyze the loop.

Definition at line 485 of file LoopAccessAnalysis.h.

const RuntimePointerChecking* llvm::LoopAccessInfo::getRuntimePointerChecking ( ) const
inline

Definition at line 447 of file LoopAccessAnalysis.h.

Referenced by llvm::LoopVersioning::needsRuntimeChecks().

bool llvm::LoopAccessInfo::hasStoreToLoopInvariantAddress ( ) const
inline

Checks existence of store to invariant address inside loop.

If the loop has any store to invariant address, then it returns true, else returns false.

Definition at line 509 of file LoopAccessAnalysis.h.

bool LoopAccessInfo::isUniform ( Value V) const

Returns true if the value V is uniform within the loop.

Definition at line 1554 of file LoopAccessAnalysis.cpp.

References llvm::ScalarEvolution::getSCEV(), and llvm::ScalarEvolution::isLoopInvariant().

void LoopAccessInfo::print ( raw_ostream OS,
unsigned  Depth = 0 
) const

Member Data Documentation

unsigned llvm::LoopAccessInfo::NumSymbolicStrides

Used to ensure that if the analysis was run with speculating the value of symbolic strides, the client queries it with the same assumption.

Only used in DEBUG build but we don't want NDEBUG-dependent ABI.

Definition at line 504 of file LoopAccessAnalysis.h.


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