@@ -679,16 +679,17 @@ class AccessAnalysis {
679679 const DenseMap<Value *, const SCEV *> &Strides,
680680 DenseMap<Value *, unsigned > &DepSetId,
681681 Loop *TheLoop, unsigned &RunningDepId,
682- unsigned ASId, bool ShouldCheckStride, bool Assume);
682+ unsigned ASId, bool Assume);
683683
684684 // / Check whether we can check the pointers at runtime for
685685 // / non-intersection.
686686 // /
687687 // / Returns true if we need no check or if we do and we can generate them
688688 // / (i.e. the pointers have computable bounds).
689689 bool canCheckPtrAtRT (RuntimePointerChecking &RtCheck, ScalarEvolution *SE,
690- Loop *TheLoop, const DenseMap<Value *, const SCEV *> &Strides,
691- Value *&UncomputablePtr, bool ShouldCheckWrap = false );
690+ Loop *TheLoop,
691+ const DenseMap<Value *, const SCEV *> &Strides,
692+ Value *&UncomputablePtr);
692693
693694 // / Goes over all memory accesses, checks whether a RT check is needed
694695 // / and builds sets of dependent accesses.
@@ -1117,13 +1118,11 @@ findForkedPointer(PredicatedScalarEvolution &PSE,
11171118 return {{replaceSymbolicStrideSCEV (PSE, StridesMap, Ptr), false }};
11181119}
11191120
1120- bool AccessAnalysis::createCheckForAccess (RuntimePointerChecking &RtCheck,
1121- MemAccessInfo Access, Type *AccessTy,
1122- const DenseMap<Value *, const SCEV *> &StridesMap,
1123- DenseMap<Value *, unsigned > &DepSetId,
1124- Loop *TheLoop, unsigned &RunningDepId,
1125- unsigned ASId, bool ShouldCheckWrap,
1126- bool Assume) {
1121+ bool AccessAnalysis::createCheckForAccess (
1122+ RuntimePointerChecking &RtCheck, MemAccessInfo Access, Type *AccessTy,
1123+ const DenseMap<Value *, const SCEV *> &StridesMap,
1124+ DenseMap<Value *, unsigned > &DepSetId, Loop *TheLoop,
1125+ unsigned &RunningDepId, unsigned ASId, bool Assume) {
11271126 Value *Ptr = Access.getPointer ();
11281127
11291128 SmallVector<PointerIntPair<const SCEV *, 1 , bool >> TranslatedPtrs =
@@ -1153,8 +1152,7 @@ bool AccessAnalysis::createCheckForAccess(RuntimePointerChecking &RtCheck,
11531152
11541153 // When we run after a failing dependency check we have to make sure
11551154 // we don't have wrapping pointers.
1156- if (ShouldCheckWrap &&
1157- !isNoWrap (PSE, AR, TranslatedPtrs.size () == 1 ? Ptr : nullptr , AccessTy,
1155+ if (!isNoWrap (PSE, AR, TranslatedPtrs.size () == 1 ? Ptr : nullptr , AccessTy,
11581156 TheLoop, Assume)) {
11591157 return false ;
11601158 }
@@ -1183,10 +1181,10 @@ bool AccessAnalysis::createCheckForAccess(RuntimePointerChecking &RtCheck,
11831181 return true ;
11841182}
11851183
1186- bool AccessAnalysis::canCheckPtrAtRT (RuntimePointerChecking &RtCheck,
1187- ScalarEvolution *SE, Loop *TheLoop,
1188- const DenseMap<Value *, const SCEV *> &StridesMap,
1189- Value *&UncomputablePtr, bool ShouldCheckWrap ) {
1184+ bool AccessAnalysis::canCheckPtrAtRT (
1185+ RuntimePointerChecking &RtCheck, ScalarEvolution *SE, Loop *TheLoop,
1186+ const DenseMap<Value *, const SCEV *> &StridesMap,
1187+ Value *&UncomputablePtr) {
11901188 // Find pointers with computable bounds. We are going to use this information
11911189 // to place a runtime bound check.
11921190 bool CanDoRT = true ;
@@ -1246,7 +1244,7 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck,
12461244 for (const auto &AccessTy : Accesses[Access]) {
12471245 if (!createCheckForAccess (RtCheck, Access, AccessTy, StridesMap,
12481246 DepSetId, TheLoop, RunningDepId, ASId,
1249- ShouldCheckWrap, false )) {
1247+ false )) {
12501248 LLVM_DEBUG (dbgs () << " LAA: Can't find bounds for ptr:"
12511249 << *Access.getPointer () << ' \n ' );
12521250 Retries.emplace_back (Access, AccessTy);
@@ -1276,7 +1274,7 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck,
12761274 for (const auto &[Access, AccessTy] : Retries) {
12771275 if (!createCheckForAccess (RtCheck, Access, AccessTy, StridesMap,
12781276 DepSetId, TheLoop, RunningDepId, ASId,
1279- ShouldCheckWrap, /* Assume=*/ true )) {
1277+ /* Assume=*/ true )) {
12801278 CanDoAliasSetRT = false ;
12811279 UncomputablePtr = Access.getPointer ();
12821280 break ;
@@ -2646,9 +2644,8 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, const LoopInfo *LI,
26462644 // Find pointers with computable bounds. We are going to use this information
26472645 // to place a runtime bound check.
26482646 Value *UncomputablePtr = nullptr ;
2649- bool CanDoRTIfNeeded =
2650- Accesses.canCheckPtrAtRT (*PtrRtChecking, PSE->getSE (), TheLoop,
2651- SymbolicStrides, UncomputablePtr, false );
2647+ bool CanDoRTIfNeeded = Accesses.canCheckPtrAtRT (
2648+ *PtrRtChecking, PSE->getSE (), TheLoop, SymbolicStrides, UncomputablePtr);
26522649 if (!CanDoRTIfNeeded) {
26532650 const auto *I = dyn_cast_or_null<Instruction>(UncomputablePtr);
26542651 recordAnalysis (" CantIdentifyArrayBounds" , I)
@@ -2679,7 +2676,7 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, const LoopInfo *LI,
26792676 auto *SE = PSE->getSE ();
26802677 UncomputablePtr = nullptr ;
26812678 CanDoRTIfNeeded = Accesses.canCheckPtrAtRT (
2682- *PtrRtChecking, SE, TheLoop, SymbolicStrides, UncomputablePtr, true );
2679+ *PtrRtChecking, SE, TheLoop, SymbolicStrides, UncomputablePtr);
26832680
26842681 // Check that we found the bounds for the pointer.
26852682 if (!CanDoRTIfNeeded) {
0 commit comments