Skip to content

Commit b0f1d7d

Browse files
committed
Remove unused parameter
1 parent f82d307 commit b0f1d7d

File tree

4 files changed

+15
-27
lines changed

4 files changed

+15
-27
lines changed

llvm/lib/Transforms/ObjCARC/DependencyAnalysis.cpp

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,8 @@ bool llvm::objcarc::CanAlterRefCount(const Instruction *Inst, const Value *Ptr,
5151
if (AliasAnalysis::onlyReadsMemory(MRB))
5252
return false;
5353
if (AliasAnalysis::onlyAccessesArgPointees(MRB)) {
54-
const DataLayout &DL = Inst->getModule()->getDataLayout();
5554
for (const Value *Op : Call->args()) {
56-
if (IsPotentialRetainableObjPtr(Op, *PA.getAA()) &&
57-
PA.related(Ptr, Op, DL))
55+
if (IsPotentialRetainableObjPtr(Op, *PA.getAA()) && PA.related(Ptr, Op))
5856
return true;
5957
}
6058
return false;
@@ -85,8 +83,6 @@ bool llvm::objcarc::CanUse(const Instruction *Inst, const Value *Ptr,
8583
if (Class == ARCInstKind::Call)
8684
return false;
8785

88-
const DataLayout &DL = Inst->getModule()->getDataLayout();
89-
9086
// Consider various instructions which may have pointer arguments which are
9187
// not "uses".
9288
if (const ICmpInst *ICI = dyn_cast<ICmpInst>(Inst)) {
@@ -99,8 +95,7 @@ bool llvm::objcarc::CanUse(const Instruction *Inst, const Value *Ptr,
9995
// For calls, just check the arguments (and not the callee operand).
10096
for (auto OI = CS->arg_begin(), OE = CS->arg_end(); OI != OE; ++OI) {
10197
const Value *Op = *OI;
102-
if (IsPotentialRetainableObjPtr(Op, *PA.getAA()) &&
103-
PA.related(Ptr, Op, DL))
98+
if (IsPotentialRetainableObjPtr(Op, *PA.getAA()) && PA.related(Ptr, Op))
10499
return true;
105100
}
106101
return false;
@@ -110,15 +105,14 @@ bool llvm::objcarc::CanUse(const Instruction *Inst, const Value *Ptr,
110105
const Value *Op = GetUnderlyingObjCPtr(SI->getPointerOperand());
111106
// If we can't tell what the underlying object was, assume there is a
112107
// dependence.
113-
return IsPotentialRetainableObjPtr(Op, *PA.getAA()) &&
114-
PA.related(Op, Ptr, DL);
108+
return IsPotentialRetainableObjPtr(Op, *PA.getAA()) && PA.related(Op, Ptr);
115109
}
116110

117111
// Check each operand for a match.
118112
for (User::const_op_iterator OI = Inst->op_begin(), OE = Inst->op_end();
119113
OI != OE; ++OI) {
120114
const Value *Op = *OI;
121-
if (IsPotentialRetainableObjPtr(Op, *PA.getAA()) && PA.related(Ptr, Op, DL))
115+
if (IsPotentialRetainableObjPtr(Op, *PA.getAA()) && PA.related(Ptr, Op))
122116
return true;
123117
}
124118
return false;

llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.cpp

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,38 +40,35 @@ using namespace llvm::objcarc;
4040

4141
bool 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

5654
bool 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
}

llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ProvenanceAnalysis {
5858

5959
DenseMap<const Value *, WeakTrackingVH> UnderlyingObjCPtrCache;
6060

61-
bool relatedCheck(const Value *A, const Value *B, const DataLayout &DL);
61+
bool relatedCheck(const Value *A, const Value *B);
6262
bool relatedSelect(const SelectInst *A, const Value *B);
6363
bool relatedPHI(const PHINode *A, const Value *B);
6464

@@ -71,7 +71,7 @@ class ProvenanceAnalysis {
7171

7272
AAResults *getAA() const { return AA; }
7373

74-
bool related(const Value *A, const Value *B, const DataLayout &DL);
74+
bool related(const Value *A, const Value *B);
7575

7676
void clear() {
7777
CachedResults.clear();

llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ bool PAEval::runOnFunction(Function &F) {
6666

6767
ProvenanceAnalysis PA;
6868
PA.setAA(&getAnalysis<AAResultsWrapperPass>().getAAResults());
69-
const DataLayout &DL = F.getParent()->getDataLayout();
7069

7170
for (Value *V1 : Values) {
7271
StringRef NameV1 = getName(V1);
@@ -75,7 +74,7 @@ bool PAEval::runOnFunction(Function &F) {
7574
if (NameV1 >= NameV2)
7675
continue;
7776
errs() << NameV1 << " and " << NameV2;
78-
if (PA.related(V1, V2, DL))
77+
if (PA.related(V1, V2))
7978
errs() << " are related.\n";
8079
else
8180
errs() << " are not related.\n";

0 commit comments

Comments
 (0)