@@ -203,11 +203,9 @@ RuntimeCheckingPtrGroup::RuntimeCheckingPtrGroup(
203
203
// /
204
204
// / There is no conflict when the intervals are disjoint:
205
205
// / NoConflict = (P2.Start >= P1.End) || (P1.Start >= P2.End)
206
- void RuntimePointerChecking::insert (Loop *Lp, Value *Ptr, const SCEV *PtrExpr,
207
- Type *AccessTy, bool WritePtr,
208
- unsigned DepSetId, unsigned ASId,
209
- PredicatedScalarEvolution &PSE,
210
- bool NeedsFreeze) {
206
+ static std::pair<const SCEV *, const SCEV *>
207
+ getStartAndEndForAccess (const Loop *Lp, const SCEV *PtrExpr, Type *AccessTy,
208
+ PredicatedScalarEvolution &PSE) {
211
209
ScalarEvolution *SE = PSE.getSE ();
212
210
213
211
const SCEV *ScStart;
@@ -242,10 +240,22 @@ void RuntimePointerChecking::insert(Loop *Lp, Value *Ptr, const SCEV *PtrExpr,
242
240
243
241
// Add the size of the pointed element to ScEnd.
244
242
auto &DL = Lp->getHeader ()->getModule ()->getDataLayout ();
245
- Type *IdxTy = DL.getIndexType (Ptr ->getType ());
243
+ Type *IdxTy = DL.getIndexType (PtrExpr ->getType ());
246
244
const SCEV *EltSizeSCEV = SE->getStoreSizeOfExpr (IdxTy, AccessTy);
247
245
ScEnd = SE->getAddExpr (ScEnd, EltSizeSCEV);
248
246
247
+ return {ScStart, ScEnd};
248
+ }
249
+
250
+ // / Calculate Start and End points of memory access using
251
+ // / getStartAndEndForAccess.
252
+ void RuntimePointerChecking::insert (Loop *Lp, Value *Ptr, const SCEV *PtrExpr,
253
+ Type *AccessTy, bool WritePtr,
254
+ unsigned DepSetId, unsigned ASId,
255
+ PredicatedScalarEvolution &PSE,
256
+ bool NeedsFreeze) {
257
+ const auto &[ScStart, ScEnd] =
258
+ getStartAndEndForAccess (Lp, PtrExpr, AccessTy, PSE);
249
259
Pointers.emplace_back (Ptr, ScStart, ScEnd, WritePtr, DepSetId, ASId, PtrExpr,
250
260
NeedsFreeze);
251
261
}
0 commit comments