@@ -164,7 +164,7 @@ class GlobalAccessRemoval {
164
164
void perform ();
165
165
166
166
protected:
167
- void visitInstruction (SILInstruction *I);
167
+ bool visitInstruction (SILInstruction *I);
168
168
void recordAccess (SILInstruction *beginAccess, DisjointAccessLocationKey key,
169
169
AccessStorage::Kind storageKind, bool hasNoNestedConflict);
170
170
void removeNonreentrantAccess ();
@@ -180,27 +180,33 @@ void GlobalAccessRemoval::perform() {
180
180
continue ;
181
181
182
182
for (auto &BB : F) {
183
- for (auto &I : BB)
184
- visitInstruction (&I);
183
+ for (auto &I : BB) {
184
+ if (!visitInstruction (&I))
185
+ return ;
186
+ }
185
187
}
186
188
}
187
189
removeNonreentrantAccess ();
188
190
}
189
191
190
- void GlobalAccessRemoval::visitInstruction (SILInstruction *I) {
192
+ bool GlobalAccessRemoval::visitInstruction (SILInstruction *I) {
191
193
if (auto *BAI = dyn_cast<BeginAccessInst>(I)) {
192
194
auto storageAndBase = AccessStorageWithBase::compute (BAI->getSource ());
195
+ if (!storageAndBase.base )
196
+ return false ;
193
197
auto key = getDisjointAccessLocation (storageAndBase);
194
198
recordAccess (BAI, key, storageAndBase.storage .getKind (),
195
199
BAI->hasNoNestedConflict ());
196
- return ;
200
+ return true ;
197
201
}
198
202
if (auto *BUAI = dyn_cast<BeginUnpairedAccessInst>(I)) {
199
203
auto storageAndBase = AccessStorageWithBase::compute (BUAI->getSource ());
204
+ if (!storageAndBase.base )
205
+ return false ;
200
206
auto key = getDisjointAccessLocation (storageAndBase);
201
207
recordAccess (BUAI, key, storageAndBase.storage .getKind (),
202
208
BUAI->hasNoNestedConflict ());
203
- return ;
209
+ return true ;
204
210
}
205
211
if (auto *KPI = dyn_cast<KeyPathInst>(I)) {
206
212
for (const KeyPathPatternComponent &component :
@@ -219,8 +225,8 @@ void GlobalAccessRemoval::visitInstruction(SILInstruction *I) {
219
225
break ;
220
226
}
221
227
}
222
- return ;
223
228
}
229
+ return true ;
224
230
}
225
231
226
232
// Record an access in the disjointAccessMap.
0 commit comments