Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/include/llvm/Analysis/LoopAccessAnalysis.h
Show First 20 Lines • Show All 157 Lines • ▼ Show 20 Lines | struct Dependence { | ||||
/// \brief Print the dependence. \p Instr is used to map the instruction | /// \brief Print the dependence. \p Instr is used to map the instruction | ||||
/// indices to instructions. | /// indices to instructions. | ||||
void print(raw_ostream &OS, unsigned Depth, | void print(raw_ostream &OS, unsigned Depth, | ||||
const SmallVectorImpl<Instruction *> &Instrs) const; | const SmallVectorImpl<Instruction *> &Instrs) const; | ||||
}; | }; | ||||
MemoryDepChecker(PredicatedScalarEvolution &PSE, const Loop *L) | MemoryDepChecker(PredicatedScalarEvolution &PSE, const Loop *L) | ||||
: PSE(PSE), InnermostLoop(L), AccessIdx(0), | : PSE(PSE), InnermostLoop(L), AccessIdx(0), MaxSafeRegisterWidth(-1U), | ||||
ShouldRetryWithRuntimeCheck(false), SafeForVectorization(true), | ShouldRetryWithRuntimeCheck(false), SafeForVectorization(true), | ||||
RecordDependences(true) {} | RecordDependences(true) {} | ||||
/// \brief Register the location (instructions are given increasing numbers) | /// \brief Register the location (instructions are given increasing numbers) | ||||
/// of a write access. | /// of a write access. | ||||
void addAccess(StoreInst *SI) { | void addAccess(StoreInst *SI) { | ||||
Value *Ptr = SI->getPointerOperand(); | Value *Ptr = SI->getPointerOperand(); | ||||
Accesses[MemAccessInfo(Ptr, true)].push_back(AccessIdx); | Accesses[MemAccessInfo(Ptr, true)].push_back(AccessIdx); | ||||
Show All 19 Lines | public: | ||||
/// \brief No memory dependence was encountered that would inhibit | /// \brief No memory dependence was encountered that would inhibit | ||||
/// vectorization. | /// vectorization. | ||||
bool isSafeForVectorization() const { return SafeForVectorization; } | bool isSafeForVectorization() const { return SafeForVectorization; } | ||||
/// \brief The maximum number of bytes of a vector register we can vectorize | /// \brief The maximum number of bytes of a vector register we can vectorize | ||||
/// the accesses safely with. | /// the accesses safely with. | ||||
uint64_t getMaxSafeDepDistBytes() { return MaxSafeDepDistBytes; } | uint64_t getMaxSafeDepDistBytes() { return MaxSafeDepDistBytes; } | ||||
/// \brief Return the number of elements that are safe to operate on | |||||
/// simultaneously, multiplied by the size of the element in bits. | |||||
uint64_t getMaxSafeRegisterWidth() const { return MaxSafeRegisterWidth; } | |||||
/// \brief In same cases when the dependency check fails we can still | /// \brief In same cases when the dependency check fails we can still | ||||
/// vectorize the loop with a dynamic array access check. | /// vectorize the loop with a dynamic array access check. | ||||
bool shouldRetryWithRuntimeCheck() { return ShouldRetryWithRuntimeCheck; } | bool shouldRetryWithRuntimeCheck() { return ShouldRetryWithRuntimeCheck; } | ||||
/// \brief Returns the memory dependences. If null is returned we exceeded | /// \brief Returns the memory dependences. If null is returned we exceeded | ||||
/// the MaxDependences threshold and this information is not | /// the MaxDependences threshold and this information is not | ||||
/// available. | /// available. | ||||
const SmallVectorImpl<Dependence> *getDependences() const { | const SmallVectorImpl<Dependence> *getDependences() const { | ||||
Show All 40 Lines | private: | ||||
SmallVector<Instruction *, 16> InstMap; | SmallVector<Instruction *, 16> InstMap; | ||||
/// \brief The program order index to be used for the next instruction. | /// \brief The program order index to be used for the next instruction. | ||||
unsigned AccessIdx; | unsigned AccessIdx; | ||||
// We can access this many bytes in parallel safely. | // We can access this many bytes in parallel safely. | ||||
uint64_t MaxSafeDepDistBytes; | uint64_t MaxSafeDepDistBytes; | ||||
/// \brief Number of elements (from consecutive iterations) that are safe to | |||||
/// operate on simultaneously, multiplied by the size of the element in bits. | |||||
/// The size of the element is taken from the memory access that is most | |||||
/// restrictive. | |||||
uint64_t MaxSafeRegisterWidth; | |||||
/// \brief If we see a non-constant dependence distance we can still try to | /// \brief If we see a non-constant dependence distance we can still try to | ||||
/// vectorize this loop with runtime checks. | /// vectorize this loop with runtime checks. | ||||
bool ShouldRetryWithRuntimeCheck; | bool ShouldRetryWithRuntimeCheck; | ||||
/// \brief No memory dependence was encountered that would inhibit | /// \brief No memory dependence was encountered that would inhibit | ||||
/// vectorization. | /// vectorization. | ||||
bool SafeForVectorization; | bool SafeForVectorization; | ||||
▲ Show 20 Lines • Show All 474 Lines • Show Last 20 Lines |