llvm::LoopAccessInfo

Drive the analysis of memory accesses in the loop

Synopsis

Declared in <llvm/Analysis/LoopAccessAnalysis.h>

class LoopAccessInfo;

Description

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. AllowPartial determines whether partial checks are generated when not all pointers could be analyzed.

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.

Member Functions

NameDescription
LoopAccessInfo [constructor]Analyze memory accesses in loop L.
canVectorizeMemory Return true if memory accesses can be analyzed without dependence cycles.
getDepChecker the Memory Dependence Checker which can determine the loop-independent and loop-carried dependences between memory accesses.
getInstructionsForAccess Return the list of instructions that use Ptr to read or write memory.
getNumLoads Return the number of load instructions in the loop.
getNumRuntimePointerChecks Number of memchecks required to prove independence of otherwise may-alias pointers.
getNumStores Return the number of store instructions in the loop.
getPSE Return the predicated ScalarEvolution used by this analysis.
getReport The diagnostics report generated for the analysis. E.g. why we couldn't analyze the loop.
getRuntimePointerChecking Return the runtime pointer checking info for this loop.
getStoresToInvariantAddresses Return the list of stores to invariant addresses.
getSymbolicStrides If an access has a symbolic strides, this maps the pointer value to the stride symbol.
hasAllowPartial Return true if, when runtime pointer checking does not have complete results, it instead has partial results for those memory accesses that could be analyzed.
hasConvergentOp Return true if the loop contains a convergent operation.
hasLoadStoreDependenceInvolvingLoopInvariantAddress Return true if the loop has memory dependence involving a load and a store to an invariant address, else return false.
hasStoreStoreDependenceInvolvingLoopInvariantAddress Return true if the loop has memory dependence involving two stores to an invariant address, else return false.
isInvariant Returns true if value V is loop invariant.
print Print the information about the memory accesses in the loop.

Static Member Functions

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