@@ -677,16 +677,17 @@ class AccessAnalysis {
677
677
const DenseMap<Value *, const SCEV *> &Strides,
678
678
DenseMap<Value *, unsigned > &DepSetId,
679
679
Loop *TheLoop, unsigned &RunningDepId,
680
- unsigned ASId, bool ShouldCheckStride, bool Assume);
680
+ unsigned ASId, bool Assume);
681
681
682
682
// / Check whether we can check the pointers at runtime for
683
683
// / non-intersection.
684
684
// /
685
685
// / Returns true if we need no check or if we do and we can generate them
686
686
// / (i.e. the pointers have computable bounds).
687
687
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);
690
691
691
692
// / Goes over all memory accesses, checks whether a RT check is needed
692
693
// / and builds sets of dependent accesses.
@@ -1115,13 +1116,11 @@ findForkedPointer(PredicatedScalarEvolution &PSE,
1115
1116
return {{replaceSymbolicStrideSCEV (PSE, StridesMap, Ptr ), false }};
1116
1117
}
1117
1118
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) {
1125
1124
Value *Ptr = Access.getPointer ();
1126
1125
1127
1126
SmallVector<PointerIntPair<const SCEV *, 1 , bool >> TranslatedPtrs =
@@ -1152,8 +1151,7 @@ bool AccessAnalysis::createCheckForAccess(RuntimePointerChecking &RtCheck,
1152
1151
1153
1152
// When we run after a failing dependency check we have to make sure
1154
1153
// 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,
1157
1155
TheLoop, Assume)) {
1158
1156
return false ;
1159
1157
}
@@ -1182,10 +1180,10 @@ bool AccessAnalysis::createCheckForAccess(RuntimePointerChecking &RtCheck,
1182
1180
return true ;
1183
1181
}
1184
1182
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) {
1189
1187
// Find pointers with computable bounds. We are going to use this information
1190
1188
// to place a runtime bound check.
1191
1189
bool CanDoRT = true ;
@@ -1245,7 +1243,7 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck,
1245
1243
for (const auto &AccessTy : Accesses[Access]) {
1246
1244
if (!createCheckForAccess (RtCheck, Access, AccessTy, StridesMap,
1247
1245
DepSetId, TheLoop, RunningDepId, ASId,
1248
- ShouldCheckWrap, false )) {
1246
+ false )) {
1249
1247
LLVM_DEBUG (dbgs () << " LAA: Can't find bounds for ptr:"
1250
1248
<< *Access.getPointer () << ' \n ' );
1251
1249
Retries.emplace_back (Access, AccessTy);
@@ -1275,7 +1273,7 @@ bool AccessAnalysis::canCheckPtrAtRT(RuntimePointerChecking &RtCheck,
1275
1273
for (const auto &[Access, AccessTy] : Retries) {
1276
1274
if (!createCheckForAccess (RtCheck, Access, AccessTy, StridesMap,
1277
1275
DepSetId, TheLoop, RunningDepId, ASId,
1278
- ShouldCheckWrap, /* Assume=*/ true )) {
1276
+ /* Assume=*/ true )) {
1279
1277
CanDoAliasSetRT = false ;
1280
1278
UncomputablePtr = Access.getPointer ();
1281
1279
break ;
@@ -2645,9 +2643,8 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, const LoopInfo *LI,
2645
2643
// Find pointers with computable bounds. We are going to use this information
2646
2644
// to place a runtime bound check.
2647
2645
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);
2651
2648
if (!CanDoRTIfNeeded) {
2652
2649
const auto *I = dyn_cast_or_null<Instruction>(UncomputablePtr);
2653
2650
recordAnalysis (" CantIdentifyArrayBounds" , I)
@@ -2678,7 +2675,7 @@ bool LoopAccessInfo::analyzeLoop(AAResults *AA, const LoopInfo *LI,
2678
2675
auto *SE = PSE->getSE ();
2679
2676
UncomputablePtr = nullptr ;
2680
2677
CanDoRTIfNeeded = Accesses.canCheckPtrAtRT (
2681
- *PtrRtChecking, SE, TheLoop, SymbolicStrides, UncomputablePtr, true );
2678
+ *PtrRtChecking, SE, TheLoop, SymbolicStrides, UncomputablePtr);
2682
2679
2683
2680
// Check that we found the bounds for the pointer.
2684
2681
if (!CanDoRTIfNeeded) {
0 commit comments