diff options
author | Florian Hahn <flo@fhahn.com> | 2024-05-20 19:29:16 +0100 |
---|---|---|
committer | Florian Hahn <flo@fhahn.com> | 2024-05-20 19:35:19 +0100 |
commit | bce3680f45b57f6ce745cb7da659f2ece745a1d1 (patch) | |
tree | 5b0217dec56e655c31b08b77113c145a080c1f5b /llvm/lib/Analysis/LoopAccessAnalysis.cpp | |
parent | 245491a9f384e4c53421196533c2a2b693efaf8d (diff) | |
download | llvm-bce3680f45b57f6ce745cb7da659f2ece745a1d1.zip llvm-bce3680f45b57f6ce745cb7da659f2ece745a1d1.tar.gz llvm-bce3680f45b57f6ce745cb7da659f2ece745a1d1.tar.bz2 |
[LAA] Move logic to compute start and end of a pointer to helper (NFC).
This allows use at other places, in particular an updated version of
https://github.com/llvm/llvm-project/pull/92307.
Diffstat (limited to 'llvm/lib/Analysis/LoopAccessAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/LoopAccessAnalysis.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp index 13dec3b..df01ad1 100644 --- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp +++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp @@ -203,11 +203,9 @@ RuntimeCheckingPtrGroup::RuntimeCheckingPtrGroup( /// /// There is no conflict when the intervals are disjoint: /// NoConflict = (P2.Start >= P1.End) || (P1.Start >= P2.End) -void RuntimePointerChecking::insert(Loop *Lp, Value *Ptr, const SCEV *PtrExpr, - Type *AccessTy, bool WritePtr, - unsigned DepSetId, unsigned ASId, - PredicatedScalarEvolution &PSE, - bool NeedsFreeze) { +static std::pair<const SCEV *, const SCEV *> +getStartAndEndForAccess(const Loop *Lp, const SCEV *PtrExpr, Type *AccessTy, + PredicatedScalarEvolution &PSE) { ScalarEvolution *SE = PSE.getSE(); const SCEV *ScStart; @@ -242,10 +240,22 @@ void RuntimePointerChecking::insert(Loop *Lp, Value *Ptr, const SCEV *PtrExpr, // Add the size of the pointed element to ScEnd. auto &DL = Lp->getHeader()->getModule()->getDataLayout(); - Type *IdxTy = DL.getIndexType(Ptr->getType()); + Type *IdxTy = DL.getIndexType(PtrExpr->getType()); const SCEV *EltSizeSCEV = SE->getStoreSizeOfExpr(IdxTy, AccessTy); ScEnd = SE->getAddExpr(ScEnd, EltSizeSCEV); + return {ScStart, ScEnd}; +} + +/// Calculate Start and End points of memory access using +/// getStartAndEndForAccess. +void RuntimePointerChecking::insert(Loop *Lp, Value *Ptr, const SCEV *PtrExpr, + Type *AccessTy, bool WritePtr, + unsigned DepSetId, unsigned ASId, + PredicatedScalarEvolution &PSE, + bool NeedsFreeze) { + const auto &[ScStart, ScEnd] = + getStartAndEndForAccess(Lp, PtrExpr, AccessTy, PSE); Pointers.emplace_back(Ptr, ScStart, ScEnd, WritePtr, DepSetId, ASId, PtrExpr, NeedsFreeze); } |