@@ -677,16 +677,17 @@ class AccessAnalysis {
677677 const DenseMap<Value *, const SCEV *> &Strides,
678678 DenseMap<Value *, unsigned > &DepSetId,
679679 Loop *TheLoop, unsigned &RunningDepId,
680- unsigned ASId, bool ShouldCheckStride, bool Assume);
680+ unsigned ASId, bool Assume);
681681
682682 // / Check whether we can check the pointers at runtime for
683683 // / non-intersection.
684684 // /
685685 // / Returns true if we need no check or if we do and we can generate them
686686 // / (i.e. the pointers have computable bounds).
687687 bool canCheckPtrAtRT (RuntimePointerChecking &RtCheck, ScalarEvolution *SE,
688- Loop *TheLoop, const DenseMap<Value *, const SCEV *> &Strides,
689- Value *&UncomputablePtr, bool ShouldCheckWrap = false );
688+ Loop *TheLoop,
689+ const DenseMap<Value *, const SCEV *> &Strides,
690+ Value *&UncomputablePtr);
690691
691692 // / Goes over all memory accesses, checks whether a RT check is needed
692693 // / and builds sets of dependent accesses.
@@ -1115,13 +1116,11 @@ findForkedPointer(PredicatedScalarEvolution &PSE,
11151116 return {{replaceSymbolicStrideSCEV (PSE, StridesMap, Ptr), false }};
11161117}
11171118
1118- bool AccessAnalysis::createCheckForAccess (RuntimePointerChecking &RtCheck,
1119- MemAccessInfo Access, Type *AccessTy,
1120- const DenseMap<Value *, const SCEV *> &StridesMap,
1121- DenseMap<Value *, unsigned > &DepSetId,
1122- Loop *TheLoop, unsigned &RunningDepId,
1123- unsigned ASId, bool ShouldCheckWrap,
1124- bool Assume) {
1119+ bool AccessAnalysis::createCheckForAccess (
1120+ RuntimePointerChecking &RtCheck, MemAccessInfo Access, Type *AccessTy,
1121+ const DenseMap<Value *, const SCEV *> &StridesMap,
1122+ DenseMap<Value *, unsigned > &DepSetId, Loop *TheLoop,
1123+ unsigned &RunningDepId, unsigned ASId, bool Assume) {
11251124 Value *Ptr = Access.getPointer ();
11261125
11271126 SmallVector<PointerIntPair<const SCEV *, 1 , bool >> TranslatedPtrs =
@@ -1152,8 +1151,7 @@ bool AccessAnalysis::createCheckForAccess(RuntimePointerChecking &RtCheck,
11521151
11531152 // When we run after a failing dependency check we have to make sure
11541153 // we don't have wrapping pointers.
1155- if (ShouldCheckWrap &&
1156- !isNoWrap (PSE, AR, TranslatedPtrs.size () == 1 ? Ptr : nullptr , AccessTy,
1154+ if (!isNoWrap (PSE, AR, TranslatedPtrs.size () == 1 ? Ptr : nullptr , AccessTy,
11571155 TheLoop, Assume)) {
11581156 return false ;
11591157 }
@@ -1182,10 +1180,10 @@ bool AccessAnalysis::createCheckForAccess(RuntimePointerChecking &RtCheck,
11821180 return true ;
11831181}
11841182
1185- bool AccessAnalysis::canCheckPtrAtRT (RuntimePointerChecking &RtCheck,
1186- ScalarEvolution *SE, Loop *TheLoop,
1187- const DenseMap<Value *, const SCEV *> &StridesMap,
1188- Value *&UncomputablePtr, bool ShouldCheckWrap ) {
1183+ bool AccessAnalysis::canCheckPtrAtRT (
1184+ RuntimePointerChecking &RtCheck, ScalarEvolution *SE, Loop *TheLoop,
1185+ const DenseMap<Value *, const SCEV *> &StridesMap,
1186+ Value *&UncomputablePtr) {
11891187 // Find pointers with computable bounds. We are going to use this information
11901188 // to place a runtime bound check.
11911189 bool CanDoRT = true ;
@@ -1245,7 +1243,7 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck,
12451243 for (const auto &AccessTy : Accesses[Access]) {
12461244 if (!createCheckForAccess (RtCheck, Access, AccessTy, StridesMap,
12471245 DepSetId, TheLoop, RunningDepId, ASId,
1248- ShouldCheckWrap, false )) {
1246+ false )) {
12491247 LLVM_DEBUG (dbgs () << " LAA: Can't find bounds for ptr:"
12501248 << *Access.getPointer () << ' \n ' );
12511249 Retries.emplace_back (Access, AccessTy);
@@ -1275,7 +1273,7 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck,
12751273 for (const auto &[Access, AccessTy] : Retries) {
12761274 if (!createCheckForAccess (RtCheck, Access, AccessTy, StridesMap,
12771275 DepSetId, TheLoop, RunningDepId, ASId,
1278- ShouldCheckWrap, /* Assume=*/ true )) {
1276+ /* Assume=*/ true )) {
12791277 CanDoAliasSetRT = false ;
12801278 UncomputablePtr = Access.getPointer ();
12811279 break ;
@@ -2645,9 +2643,8 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, const LoopInfo *LI,
26452643 // Find pointers with computable bounds. We are going to use this information
26462644 // to place a runtime bound check.
26472645 Value *UncomputablePtr = nullptr ;
2648- bool CanDoRTIfNeeded =
2649- Accesses.canCheckPtrAtRT (*PtrRtChecking, PSE->getSE (), TheLoop,
2650- SymbolicStrides, UncomputablePtr, false );
2646+ bool CanDoRTIfNeeded = Accesses.canCheckPtrAtRT (
2647+ *PtrRtChecking, PSE->getSE (), TheLoop, SymbolicStrides, UncomputablePtr);
26512648 if (!CanDoRTIfNeeded) {
26522649 const auto *I = dyn_cast_or_null<Instruction>(UncomputablePtr);
26532650 recordAnalysis (" CantIdentifyArrayBounds" , I)
@@ -2678,7 +2675,7 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, const LoopInfo *LI,
26782675 auto *SE = PSE->getSE ();
26792676 UncomputablePtr = nullptr ;
26802677 CanDoRTIfNeeded = Accesses.canCheckPtrAtRT (
2681- *PtrRtChecking, SE, TheLoop, SymbolicStrides, UncomputablePtr, true );
2678+ *PtrRtChecking, SE, TheLoop, SymbolicStrides, UncomputablePtr);
26822679
26832680 // Check that we found the bounds for the pointer.
26842681 if (!CanDoRTIfNeeded) {
0 commit comments