@@ -40,38 +40,35 @@ using namespace llvm::objcarc;
40
40
41
41
bool ProvenanceAnalysis::relatedSelect (const SelectInst *A,
42
42
const Value *B) {
43
- const DataLayout &DL = A->getModule ()->getDataLayout ();
44
43
// If the values are Selects with the same condition, we can do a more precise
45
44
// check: just check for relations between the values on corresponding arms.
46
45
if (const SelectInst *SB = dyn_cast<SelectInst>(B))
47
46
if (A->getCondition () == SB->getCondition ())
48
- return related (A->getTrueValue (), SB->getTrueValue (), DL ) ||
49
- related (A->getFalseValue (), SB->getFalseValue (), DL );
47
+ return related (A->getTrueValue (), SB->getTrueValue ()) ||
48
+ related (A->getFalseValue (), SB->getFalseValue ());
50
49
51
50
// Check both arms of the Select node individually.
52
- return related (A->getTrueValue (), B, DL) ||
53
- related (A->getFalseValue (), B, DL);
51
+ return related (A->getTrueValue (), B) || related (A->getFalseValue (), B);
54
52
}
55
53
56
54
bool ProvenanceAnalysis::relatedPHI (const PHINode *A,
57
55
const Value *B) {
58
- const DataLayout &DL = A->getModule ()->getDataLayout ();
59
56
// If the values are PHIs in the same block, we can do a more precise as well
60
57
// as efficient check: just check for relations between the values on
61
58
// corresponding edges.
62
59
if (const PHINode *PNB = dyn_cast<PHINode>(B))
63
60
if (PNB->getParent () == A->getParent ()) {
64
61
for (unsigned i = 0 , e = A->getNumIncomingValues (); i != e; ++i)
65
62
if (related (A->getIncomingValue (i),
66
- PNB->getIncomingValueForBlock (A->getIncomingBlock (i)), DL ))
63
+ PNB->getIncomingValueForBlock (A->getIncomingBlock (i))))
67
64
return true ;
68
65
return false ;
69
66
}
70
67
71
68
// Check each unique source of the PHI node against B.
72
69
SmallPtrSet<const Value *, 4 > UniqueSrc;
73
70
for (Value *PV1 : A->incoming_values ()) {
74
- if (UniqueSrc.insert (PV1).second && related (PV1, B, DL ))
71
+ if (UniqueSrc.insert (PV1).second && related (PV1, B))
75
72
return true ;
76
73
}
77
74
@@ -112,8 +109,7 @@ static bool IsStoredObjCPointer(const Value *P) {
112
109
return false ;
113
110
}
114
111
115
- bool ProvenanceAnalysis::relatedCheck (const Value *A, const Value *B,
116
- const DataLayout &DL) {
112
+ bool ProvenanceAnalysis::relatedCheck (const Value *A, const Value *B) {
117
113
// Ask regular AliasAnalysis, for a first approximation.
118
114
switch (AA->alias (A, B)) {
119
115
case NoAlias:
@@ -160,8 +156,7 @@ bool ProvenanceAnalysis::relatedCheck(const Value *A, const Value *B,
160
156
return true ;
161
157
}
162
158
163
- bool ProvenanceAnalysis::related (const Value *A, const Value *B,
164
- const DataLayout &DL) {
159
+ bool ProvenanceAnalysis::related (const Value *A, const Value *B) {
165
160
A = GetUnderlyingObjCPtrCached (A, UnderlyingObjCPtrCache);
166
161
B = GetUnderlyingObjCPtrCached (B, UnderlyingObjCPtrCache);
167
162
@@ -178,7 +173,7 @@ bool ProvenanceAnalysis::related(const Value *A, const Value *B,
178
173
if (!Pair.second )
179
174
return Pair.first ->second ;
180
175
181
- bool Result = relatedCheck (A, B, DL );
176
+ bool Result = relatedCheck (A, B);
182
177
CachedResults[ValuePairTy (A, B)] = Result;
183
178
return Result;
184
179
}
0 commit comments