@@ -40,38 +40,35 @@ using namespace llvm::objcarc;
4040
4141bool ProvenanceAnalysis::relatedSelect (const SelectInst *A,
4242 const Value *B) {
43- const DataLayout &DL = A->getModule ()->getDataLayout ();
4443 // If the values are Selects with the same condition, we can do a more precise
4544 // check: just check for relations between the values on corresponding arms.
4645 if (const SelectInst *SB = dyn_cast<SelectInst>(B))
4746 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 ());
5049
5150 // 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);
5452}
5553
5654bool ProvenanceAnalysis::relatedPHI (const PHINode *A,
5755 const Value *B) {
58- const DataLayout &DL = A->getModule ()->getDataLayout ();
5956 // If the values are PHIs in the same block, we can do a more precise as well
6057 // as efficient check: just check for relations between the values on
6158 // corresponding edges.
6259 if (const PHINode *PNB = dyn_cast<PHINode>(B))
6360 if (PNB->getParent () == A->getParent ()) {
6461 for (unsigned i = 0 , e = A->getNumIncomingValues (); i != e; ++i)
6562 if (related (A->getIncomingValue (i),
66- PNB->getIncomingValueForBlock (A->getIncomingBlock (i)), DL ))
63+ PNB->getIncomingValueForBlock (A->getIncomingBlock (i))))
6764 return true ;
6865 return false ;
6966 }
7067
7168 // Check each unique source of the PHI node against B.
7269 SmallPtrSet<const Value *, 4 > UniqueSrc;
7370 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))
7572 return true ;
7673 }
7774
@@ -112,8 +109,7 @@ static bool IsStoredObjCPointer(const Value *P) {
112109 return false ;
113110}
114111
115- bool ProvenanceAnalysis::relatedCheck (const Value *A, const Value *B,
116- const DataLayout &DL) {
112+ bool ProvenanceAnalysis::relatedCheck (const Value *A, const Value *B) {
117113 // Ask regular AliasAnalysis, for a first approximation.
118114 switch (AA->alias (A, B)) {
119115 case NoAlias:
@@ -160,8 +156,7 @@ bool ProvenanceAnalysis::relatedCheck(const Value *A, const Value *B,
160156 return true ;
161157}
162158
163- bool ProvenanceAnalysis::related (const Value *A, const Value *B,
164- const DataLayout &DL) {
159+ bool ProvenanceAnalysis::related (const Value *A, const Value *B) {
165160 A = GetUnderlyingObjCPtrCached (A, UnderlyingObjCPtrCache);
166161 B = GetUnderlyingObjCPtrCached (B, UnderlyingObjCPtrCache);
167162
@@ -178,7 +173,7 @@ bool ProvenanceAnalysis::related(const Value *A, const Value *B,
178173 if (!Pair.second )
179174 return Pair.first ->second ;
180175
181- bool Result = relatedCheck (A, B, DL );
176+ bool Result = relatedCheck (A, B);
182177 CachedResults[ValuePairTy (A, B)] = Result;
183178 return Result;
184179}
0 commit comments