File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -78,14 +78,17 @@ inline const Value *GetUnderlyingObjCPtr(const Value *V) {
78
78
}
79
79
80
80
// / A wrapper for GetUnderlyingObjCPtr used for results memoization.
81
- inline const Value *
82
- GetUnderlyingObjCPtrCached (const Value *V,
83
- DenseMap<const Value *, WeakTrackingVH> &Cache) {
84
- if (auto InCache = Cache.lookup (V))
85
- return InCache;
81
+ inline const Value *GetUnderlyingObjCPtrCached (
82
+ const Value *V,
83
+ DenseMap<const Value *, std::pair<WeakVH, WeakTrackingVH>> &Cache) {
84
+ // The entry is invalid if either value handle is null.
85
+ auto InCache = Cache.lookup (V);
86
+ if (InCache.first && InCache.second )
87
+ return InCache.second ;
86
88
87
89
const Value *Computed = GetUnderlyingObjCPtr (V);
88
- Cache[V] = const_cast <Value *>(Computed);
90
+ Cache[V] =
91
+ std::make_pair (const_cast <Value *>(V), const_cast <Value *>(Computed));
89
92
return Computed;
90
93
}
91
94
Original file line number Diff line number Diff line change @@ -56,7 +56,8 @@ class ProvenanceAnalysis {
56
56
57
57
CachedResultsTy CachedResults;
58
58
59
- DenseMap<const Value *, WeakTrackingVH> UnderlyingObjCPtrCache;
59
+ DenseMap<const Value *, std::pair<WeakVH, WeakTrackingVH>>
60
+ UnderlyingObjCPtrCache;
60
61
61
62
bool relatedCheck (const Value *A, const Value *B);
62
63
bool relatedSelect (const SelectInst *A, const Value *B);
You can’t perform that action at this time.
0 commit comments