Skip to content

Commit 5fb0ae1

Browse files
authored
[LegacyPM] Remove unused getAdjustedAnalysisPointer() method (NFC) (#145738)
This never actually gets overridden and always returns this, so drop it. Noticed this looking into why the pass vtables are so huge.
1 parent 9ccf613 commit 5fb0ae1

File tree

4 files changed

+3
-44
lines changed

4 files changed

+3
-44
lines changed

llvm/docs/AliasAnalysis.rst

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -256,20 +256,6 @@ analysis run method (``run`` for a ``Pass``, ``runOnFunction`` for a
256256
return false;
257257
}
258258

259-
Required methods to override
260-
----------------------------
261-
262-
You must override the ``getAdjustedAnalysisPointer`` method on all subclasses
263-
of ``AliasAnalysis``. An example implementation of this method would look like:
264-
265-
.. code-block:: c++
266-
267-
void *getAdjustedAnalysisPointer(const void* ID) override {
268-
if (ID == &AliasAnalysis::ID)
269-
return (AliasAnalysis*)this;
270-
return this;
271-
}
272-
273259
Interfaces which may be specified
274260
---------------------------------
275261

llvm/include/llvm/Pass.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,6 @@ class LLVM_ABI Pass {
175175
/// longer used.
176176
virtual void releaseMemory();
177177

178-
/// getAdjustedAnalysisPointer - This method is used when a pass implements
179-
/// an analysis interface through multiple inheritance. If needed, it should
180-
/// override this to adjust the this pointer as needed for the specified pass
181-
/// info.
182-
virtual void *getAdjustedAnalysisPointer(AnalysisID ID);
183178
virtual ImmutablePass *getAsImmutablePass();
184179
virtual PMDataManager *getAsPMDataManager();
185180

llvm/include/llvm/PassAnalysisSupport.h

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,7 @@ AnalysisType *Pass::getAnalysisIfAvailable() const {
214214
assert(Resolver && "Pass not resident in a PassManager object!");
215215

216216
const void *PI = &AnalysisType::ID;
217-
218-
Pass *ResultPass = Resolver->getAnalysisIfAvailable(PI);
219-
if (!ResultPass) return nullptr;
220-
221-
// Because the AnalysisType may not be a subclass of pass (for
222-
// AnalysisGroups), we use getAdjustedAnalysisPointer here to potentially
223-
// adjust the return pointer (because the class may multiply inherit, once
224-
// from pass, once from AnalysisType).
225-
return (AnalysisType*)ResultPass->getAdjustedAnalysisPointer(PI);
217+
return (AnalysisType *)Resolver->getAnalysisIfAvailable(PI);
226218
}
227219

228220
/// getAnalysis<AnalysisType>() - This function is used by subclasses to get
@@ -245,12 +237,7 @@ AnalysisType &Pass::getAnalysisID(AnalysisID PI) const {
245237
assert(ResultPass &&
246238
"getAnalysis*() called on an analysis that was not "
247239
"'required' by pass!");
248-
249-
// Because the AnalysisType may not be a subclass of pass (for
250-
// AnalysisGroups), we use getAdjustedAnalysisPointer here to potentially
251-
// adjust the return pointer (because the class may multiply inherit, once
252-
// from pass, once from AnalysisType).
253-
return *(AnalysisType*)ResultPass->getAdjustedAnalysisPointer(PI);
240+
return *(AnalysisType *)ResultPass;
254241
}
255242

256243
/// getAnalysis<AnalysisType>() - This function is used by subclasses to get
@@ -282,12 +269,7 @@ AnalysisType &Pass::getAnalysisID(AnalysisID PI, Function &F, bool *Changed) {
282269
else
283270
assert(!LocalChanged &&
284271
"A pass trigged a code update but the update status is lost");
285-
286-
// Because the AnalysisType may not be a subclass of pass (for
287-
// AnalysisGroups), we use getAdjustedAnalysisPointer here to potentially
288-
// adjust the return pointer (because the class may multiply inherit, once
289-
// from pass, once from AnalysisType).
290-
return *(AnalysisType*)ResultPass->getAdjustedAnalysisPointer(PI);
272+
return *(AnalysisType *)ResultPass;
291273
}
292274

293275
} // end namespace llvm

llvm/lib/IR/Pass.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,6 @@ void Pass::verifyAnalysis() const {
107107
// By default, don't do anything.
108108
}
109109

110-
void *Pass::getAdjustedAnalysisPointer(AnalysisID AID) {
111-
return this;
112-
}
113-
114110
ImmutablePass *Pass::getAsImmutablePass() {
115111
return nullptr;
116112
}

0 commit comments

Comments
 (0)