@@ -47,7 +47,6 @@ namespace {
47
47
struct MemBehaviorKeyTy {
48
48
// The SILValue pair:
49
49
size_t V1, V2;
50
- RetainObserveKind InspectionMode;
51
50
};
52
51
}
53
52
@@ -201,24 +200,16 @@ class AliasAnalysis : public SILAnalysis {
201
200
202
201
// / Use the alias analysis to determine the memory behavior of Inst with
203
202
// / respect to V.
204
- // /
205
- // / TODO: When ref count behavior is separated from generic memory behavior,
206
- // / the InspectionMode flag will be unnecessary.
207
- MemoryBehavior computeMemoryBehavior (SILInstruction *Inst, SILValue V,
208
- RetainObserveKind);
203
+ MemoryBehavior computeMemoryBehavior (SILInstruction *Inst, SILValue V);
209
204
210
205
// / Use the alias analysis to determine the memory behavior of Inst with
211
206
// / respect to V.
212
- // /
213
- // / TODO: When ref count behavior is separated from generic memory behavior,
214
- // / the InspectionMode flag will be unnecessary.
215
- MemoryBehavior computeMemoryBehaviorInner (SILInstruction *Inst, SILValue V,
216
- RetainObserveKind);
207
+ MemoryBehavior computeMemoryBehaviorInner (SILInstruction *Inst, SILValue V);
217
208
218
209
// / Returns true if \p Inst may read from memory in a manner that
219
210
// / affects V.
220
211
bool mayReadFromMemory (SILInstruction *Inst, SILValue V) {
221
- auto B = computeMemoryBehavior (Inst, V, RetainObserveKind::IgnoreRetains );
212
+ auto B = computeMemoryBehavior (Inst, V);
222
213
return B == MemoryBehavior::MayRead ||
223
214
B == MemoryBehavior::MayReadWrite ||
224
215
B == MemoryBehavior::MayHaveSideEffects;
@@ -227,7 +218,7 @@ class AliasAnalysis : public SILAnalysis {
227
218
// / Returns true if \p Inst may write to memory in a manner that
228
219
// / affects V.
229
220
bool mayWriteToMemory (SILInstruction *Inst, SILValue V) {
230
- auto B = computeMemoryBehavior (Inst, V, RetainObserveKind::IgnoreRetains );
221
+ auto B = computeMemoryBehavior (Inst, V);
231
222
return B == MemoryBehavior::MayWrite ||
232
223
B == MemoryBehavior::MayReadWrite ||
233
224
B == MemoryBehavior::MayHaveSideEffects;
@@ -236,26 +227,10 @@ class AliasAnalysis : public SILAnalysis {
236
227
// / Returns true if \p Inst may read or write to memory in a manner that
237
228
// / affects V.
238
229
bool mayReadOrWriteMemory (SILInstruction *Inst, SILValue V) {
239
- auto B = computeMemoryBehavior (Inst, V, RetainObserveKind::IgnoreRetains );
230
+ auto B = computeMemoryBehavior (Inst, V);
240
231
return MemoryBehavior::None != B;
241
232
}
242
233
243
- // / Returns true if Inst may have side effects in a manner that affects V.
244
- bool mayHaveSideEffects (SILInstruction *Inst, SILValue V) {
245
- auto B = computeMemoryBehavior (Inst, V, RetainObserveKind::ObserveRetains);
246
- return B == MemoryBehavior::MayWrite ||
247
- B == MemoryBehavior::MayReadWrite ||
248
- B == MemoryBehavior::MayHaveSideEffects;
249
- }
250
-
251
- // / Returns true if Inst may have side effects in a manner that affects
252
- // / V. This is independent of whether or not Inst may write to V and is meant
253
- // / to encode notions such as ref count modifications.
254
- bool mayHavePureSideEffects (SILInstruction *Inst, SILValue V) {
255
- auto B = computeMemoryBehavior (Inst, V, RetainObserveKind::ObserveRetains);
256
- return MemoryBehavior::MayHaveSideEffects == B;
257
- }
258
-
259
234
// / Returns true if \p Ptr may be released in the function call \p FAS.
260
235
bool canApplyDecrementRefCount (FullApplySite FAS, SILValue Ptr);
261
236
@@ -268,8 +243,7 @@ class AliasAnalysis : public SILAnalysis {
268
243
AliasKeyTy toAliasKey (SILValue V1, SILValue V2, SILType Type1, SILType Type2);
269
244
270
245
// / Encodes the memory behavior query as a MemBehaviorKeyTy.
271
- MemBehaviorKeyTy toMemoryBehaviorKey (SILInstruction *V1, SILValue V2,
272
- RetainObserveKind K);
246
+ MemBehaviorKeyTy toMemoryBehaviorKey (SILInstruction *V1, SILValue V2);
273
247
274
248
virtual void invalidate () override {
275
249
AliasCache.clear ();
@@ -330,24 +304,21 @@ namespace llvm {
330
304
template <> struct DenseMapInfo <MemBehaviorKeyTy> {
331
305
static inline MemBehaviorKeyTy getEmptyKey () {
332
306
auto Allone = std::numeric_limits<size_t >::max ();
333
- return {0 , Allone, RetainObserveKind::RetainObserveKindEnd };
307
+ return {0 , Allone};
334
308
}
335
309
static inline MemBehaviorKeyTy getTombstoneKey () {
336
310
auto Allone = std::numeric_limits<size_t >::max ();
337
- return {Allone, 0 , RetainObserveKind::RetainObserveKindEnd };
311
+ return {Allone, 0 };
338
312
}
339
313
static unsigned getHashValue (const MemBehaviorKeyTy V) {
340
314
unsigned H = 0 ;
341
315
H ^= DenseMapInfo<size_t >::getHashValue (V.V1 );
342
316
H ^= DenseMapInfo<size_t >::getHashValue (V.V2 );
343
- H ^= DenseMapInfo<int >::getHashValue (static_cast <int >(V.InspectionMode ));
344
317
return H;
345
318
}
346
319
static bool isEqual (const MemBehaviorKeyTy LHS,
347
320
const MemBehaviorKeyTy RHS) {
348
- return LHS.V1 == RHS.V1 &&
349
- LHS.V2 == RHS.V2 &&
350
- LHS.InspectionMode == RHS.InspectionMode ;
321
+ return LHS.V1 == RHS.V1 && LHS.V2 == RHS.V2 ;
351
322
}
352
323
};
353
324
}
0 commit comments