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