class LoopAccessInfo
Declaration
class LoopAccessInfo { /* full declaration omitted */ };
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. If pointers can wrap or can't be expressed as affine AddRec expressions by ScalarEvolution, we will generate run-time checks by emitting a SCEVUnionPredicate. Checks for both memory dependences and the SCEV predicates contained in the PSE must be emitted in order for the results of this analysis to be valid.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:516
Method Overview
- public LoopAccessInfo(llvm::Loop * L, llvm::ScalarEvolution * SE, const llvm::TargetLibraryInfo * TLI, llvm::AliasAnalysis * AA, llvm::DominatorTree * DT, llvm::LoopInfo * LI)
- public std::pair<Instruction *, Instruction *> addRuntimeChecks(llvm::Instruction * Loc, const SmallVectorImpl<RuntimePointerChecking::PointerCheck> & PointerChecks) const
- public std::pair<Instruction *, Instruction *> addRuntimeChecks(llvm::Instruction * Loc) const
- public static bool blockNeedsPredication(llvm::BasicBlock * BB, llvm::Loop * TheLoop, llvm::DominatorTree * DT)
- public bool canVectorizeMemory() const
- public const llvm::MemoryDepChecker & getDepChecker() const
- public SmallVector<llvm::Instruction *, 4> getInstructionsForAccess(llvm::Value * Ptr, bool isWrite) const
- public uint64_t getMaxSafeDepDistBytes() const
- public unsigned int getNumLoads() const
- public unsigned int getNumRuntimePointerChecks() const
- public unsigned int getNumStores() const
- public const llvm::PredicatedScalarEvolution & getPSE() const
- public const llvm::OptimizationRemarkAnalysis * getReport() const
- public const llvm::RuntimePointerChecking * getRuntimePointerChecking() const
- public const llvm::ValueToValueMap & getSymbolicStrides() const
- public bool hasConvergentOp() const
- public bool hasDependenceInvolvingLoopInvariantAddress() const
- public bool hasStride(llvm::Value * V) const
- public bool isUniform(llvm::Value * V) const
- public void print(llvm::raw_ostream & OS, unsigned int Depth = 0) const
Methods
¶LoopAccessInfo(llvm::Loop* L,
llvm::ScalarEvolution* SE,
const llvm::TargetLibraryInfo* TLI,
llvm::AliasAnalysis* AA,
llvm::DominatorTree* DT,
llvm::LoopInfo* LI)
LoopAccessInfo(llvm::Loop* L,
llvm::ScalarEvolution* SE,
const llvm::TargetLibraryInfo* TLI,
llvm::AliasAnalysis* AA,
llvm::DominatorTree* DT,
llvm::LoopInfo* LI)
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:518
Parameters
- llvm::Loop* L
- llvm::ScalarEvolution* SE
- const llvm::TargetLibraryInfo* TLI
- llvm::AliasAnalysis* AA
- llvm::DominatorTree* DT
- llvm::LoopInfo* LI
¶std::pair<Instruction*, Instruction*>
addRuntimeChecks(
llvm::Instruction* Loc,
const SmallVectorImpl<
RuntimePointerChecking::PointerCheck>&
PointerChecks) const
std::pair<Instruction*, Instruction*>
addRuntimeChecks(
llvm::Instruction* Loc,
const SmallVectorImpl<
RuntimePointerChecking::PointerCheck>&
PointerChecks) const
Description
Generete the instructions for the checks in \p PointerChecks. 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.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:566
Parameters
- llvm::Instruction* Loc
- const SmallVectorImpl< RuntimePointerChecking::PointerCheck>& PointerChecks
¶std::pair<Instruction*, Instruction*>
addRuntimeChecks(llvm::Instruction* Loc) const
std::pair<Instruction*, Instruction*>
addRuntimeChecks(llvm::Instruction* Loc) const
Description
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.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:558
Parameters
- llvm::Instruction* Loc
¶static bool blockNeedsPredication(
llvm::BasicBlock* BB,
llvm::Loop* TheLoop,
llvm::DominatorTree* DT)
static bool blockNeedsPredication(
llvm::BasicBlock* BB,
llvm::Loop* TheLoop,
llvm::DominatorTree* DT)
Description
Return true if the block BB needs to be predicated in order for the loop to be vectorized.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:542
Parameters
- llvm::BasicBlock* BB
- llvm::Loop* TheLoop
- llvm::DominatorTree* DT
¶bool canVectorizeMemory() const
bool canVectorizeMemory() const
Description
Return true we can analyze the memory accesses in the loop and there are no memory dependence cycles.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:523
¶const llvm::MemoryDepChecker& getDepChecker()
const
const llvm::MemoryDepChecker& getDepChecker()
const
Description
the Memory Dependence Checker which can determine the loop-independent and loop-carried dependences between memory accesses.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:576
¶SmallVector<llvm::Instruction*, 4>
getInstructionsForAccess(llvm::Value* Ptr,
bool isWrite) const
SmallVector<llvm::Instruction*, 4>
getInstructionsForAccess(llvm::Value* Ptr,
bool isWrite) const
Description
Return the list of instructions that use \p Ptr to read or write memory.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:580
Parameters
- llvm::Value* Ptr
- bool isWrite
¶uint64_t getMaxSafeDepDistBytes() const
uint64_t getMaxSafeDepDistBytes() const
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:548
¶unsigned int getNumLoads() const
unsigned int getNumLoads() const
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:550
¶unsigned int getNumRuntimePointerChecks() const
unsigned int getNumRuntimePointerChecks() const
Description
Number of memchecks required to prove independence of otherwise may-alias pointers.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:536
¶unsigned int getNumStores() const
unsigned int getNumStores() const
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:549
¶const llvm::PredicatedScalarEvolution& getPSE()
const
const llvm::PredicatedScalarEvolution& getPSE()
const
Description
Used to add runtime SCEV checks. Simplifies SCEV expressions and converts them to a more usable form. All SCEV expressions during the analysis should be re-written (and therefore simplified) according to PSE. A user of LoopAccessAnalysis will need to emit the runtime checks associated with this predicate.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:606
¶const llvm::OptimizationRemarkAnalysis*
getReport() const
const llvm::OptimizationRemarkAnalysis*
getReport() const
Description
The diagnostics report generated for the analysis. E.g. why we couldn't analyze the loop.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:572
¶const llvm::RuntimePointerChecking*
getRuntimePointerChecking() const
const llvm::RuntimePointerChecking*
getRuntimePointerChecking() const
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:530
¶const llvm::ValueToValueMap& getSymbolicStrides()
const
const llvm::ValueToValueMap& getSymbolicStrides()
const
Description
If an access has a symbolic strides, this maps the pointer value to the stride symbol.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:587
¶bool hasConvergentOp() const
bool hasConvergentOp() const
Description
Return true if there is a convergent operation in the loop. There may still be reported runtime pointer checks that would be required, but it is not legal to insert them.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:528
¶bool hasDependenceInvolvingLoopInvariantAddress()
const
bool hasDependenceInvolvingLoopInvariantAddress()
const
Description
If the loop has memory dependence involving an invariant address, i.e. two stores or a store and a load, then return true, else return false.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:597
¶bool hasStride(llvm::Value* V) const
bool hasStride(llvm::Value* V) const
Description
Pointer has a symbolic stride.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:590
Parameters
- llvm::Value* V
¶bool isUniform(llvm::Value* V) const
bool isUniform(llvm::Value* V) const
Description
Returns true if the value V is uniform within the loop.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:546
Parameters
- llvm::Value* V
¶void print(llvm::raw_ostream& OS,
unsigned int Depth = 0) const
void print(llvm::raw_ostream& OS,
unsigned int Depth = 0) const
Description
Print the information about the memory accesses in the loop.
Declared at: llvm/include/llvm/Analysis/LoopAccessAnalysis.h:593
Parameters
- llvm::raw_ostream& OS
- unsigned int Depth = 0