|
LLVM
3.7.0
|
Drive the analysis of memory accesses in the loop. More...
#include <LoopAccessAnalysis.h>
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 RuntimePointerChecking * | getRuntimePointerChecking () 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 MemoryDepChecker & | getDepChecker () 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... | |
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.
| 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.
| std::pair< Instruction *, Instruction * > LoopAccessInfo::addRuntimeCheck | ( | Instruction * | Loc, |
| const SmallVectorImpl< int > * | PtrPartition = nullptr |
||
| ) | const |
Add code that checks at runtime if the accessed arrays overlap.
Returns a pair of instructions where the first element is the first instruction generated in possibly a sequence of instructions and the second value is the final comparator value or NULL if no check is needed.
If PtrPartition is set, it contains the partition number for pointers (-1 if the pointer belongs to multiple partitions). In this case omit checks between pointers belonging to the same partition.
Definition at line 1569 of file LoopAccessAnalysis.cpp.
References llvm::Check(), llvm::IRBuilder< preserveNames, T, Inserter >::CreateAnd(), llvm::IRBuilder< preserveNames, T, Inserter >::CreateBitCast(), llvm::IRBuilder< preserveNames, T, Inserter >::CreateICmpULE(), llvm::IRBuilder< preserveNames, T, Inserter >::CreateOr(), llvm::dbgs(), DEBUG, llvm::DL, llvm::SCEVExpander::expandCodeFor(), llvm::Value::getContext(), getFirstInst(), llvm::Type::getInt8PtrTy(), llvm::Type::getPointerAddressSpace(), llvm::ScalarEvolution::getSCEV(), llvm::ConstantInt::getTrue(), llvm::Intrinsic::getType(), llvm::Value::getType(), llvm::RuntimePointerChecking::CheckingPtrGroup::High, llvm::IRBuilder< preserveNames, T, Inserter >::Insert(), llvm::ScalarEvolution::isLoopInvariant(), llvm::RuntimePointerChecking::CheckingPtrGroup::Low, llvm::RuntimePointerChecking::CheckingPtrGroup::Members, and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
Referenced by llvm::LoopVersioning::versionLoop().
|
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().
|
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.
|
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.
|
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().
|
inline |
Definition at line 466 of file LoopAccessAnalysis.h.
|
inline |
Definition at line 468 of file LoopAccessAnalysis.h.
|
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().
|
inline |
Definition at line 467 of file LoopAccessAnalysis.h.
|
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.
|
inline |
Definition at line 447 of file LoopAccessAnalysis.h.
Referenced by llvm::LoopVersioning::needsRuntimeChecks().
|
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.
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 |
Print the information about the memory accesses in the loop.
Definition at line 1677 of file LoopAccessAnalysis.cpp.
References llvm::MemoryDepChecker::getInterestingDependences(), llvm::MemoryDepChecker::getMemoryInstructions(), llvm::raw_ostream::indent(), llvm::RuntimePointerChecking::Need, and llvm::RuntimePointerChecking::print().
Referenced by llvm::LoopAccessAnalysis::print().
| 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.
1.8.6