[llvm] 5fb0ae1 - [LegacyPM] Remove unused getAdjustedAnalysisPointer() method (NFC) (#145738)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 26 00:04:10 PDT 2025
Author: Nikita Popov
Date: 2025-06-26T09:04:07+02:00
New Revision: 5fb0ae1a5b5849cddeaf2f3e3fe64f45282d74d4
URL: https://github.com/llvm/llvm-project/commit/5fb0ae1a5b5849cddeaf2f3e3fe64f45282d74d4
DIFF: https://github.com/llvm/llvm-project/commit/5fb0ae1a5b5849cddeaf2f3e3fe64f45282d74d4.diff
LOG: [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.
Added:
Modified:
llvm/docs/AliasAnalysis.rst
llvm/include/llvm/Pass.h
llvm/include/llvm/PassAnalysisSupport.h
llvm/lib/IR/Pass.cpp
Removed:
################################################################################
diff --git a/llvm/docs/AliasAnalysis.rst b/llvm/docs/AliasAnalysis.rst
index 7afe0e277bd4f..1830cca915049 100644
--- a/llvm/docs/AliasAnalysis.rst
+++ b/llvm/docs/AliasAnalysis.rst
@@ -256,20 +256,6 @@ analysis run method (``run`` for a ``Pass``, ``runOnFunction`` for a
return false;
}
-Required methods to override
-----------------------------
-
-You must override the ``getAdjustedAnalysisPointer`` method on all subclasses
-of ``AliasAnalysis``. An example implementation of this method would look like:
-
-.. code-block:: c++
-
- void *getAdjustedAnalysisPointer(const void* ID) override {
- if (ID == &AliasAnalysis::ID)
- return (AliasAnalysis*)this;
- return this;
- }
-
Interfaces which may be specified
---------------------------------
diff --git a/llvm/include/llvm/Pass.h b/llvm/include/llvm/Pass.h
index 58c45e75b3f0a..34f4f7f804a38 100644
--- a/llvm/include/llvm/Pass.h
+++ b/llvm/include/llvm/Pass.h
@@ -175,11 +175,6 @@ class LLVM_ABI Pass {
/// longer used.
virtual void releaseMemory();
- /// getAdjustedAnalysisPointer - This method is used when a pass implements
- /// an analysis interface through multiple inheritance. If needed, it should
- /// override this to adjust the this pointer as needed for the specified pass
- /// info.
- virtual void *getAdjustedAnalysisPointer(AnalysisID ID);
virtual ImmutablePass *getAsImmutablePass();
virtual PMDataManager *getAsPMDataManager();
diff --git a/llvm/include/llvm/PassAnalysisSupport.h b/llvm/include/llvm/PassAnalysisSupport.h
index 02abb00b66b52..e81c0c4642d20 100644
--- a/llvm/include/llvm/PassAnalysisSupport.h
+++ b/llvm/include/llvm/PassAnalysisSupport.h
@@ -214,15 +214,7 @@ AnalysisType *Pass::getAnalysisIfAvailable() const {
assert(Resolver && "Pass not resident in a PassManager object!");
const void *PI = &AnalysisType::ID;
-
- Pass *ResultPass = Resolver->getAnalysisIfAvailable(PI);
- if (!ResultPass) return nullptr;
-
- // Because the AnalysisType may not be a subclass of pass (for
- // AnalysisGroups), we use getAdjustedAnalysisPointer here to potentially
- // adjust the return pointer (because the class may multiply inherit, once
- // from pass, once from AnalysisType).
- return (AnalysisType*)ResultPass->getAdjustedAnalysisPointer(PI);
+ return (AnalysisType *)Resolver->getAnalysisIfAvailable(PI);
}
/// getAnalysis<AnalysisType>() - This function is used by subclasses to get
@@ -245,12 +237,7 @@ AnalysisType &Pass::getAnalysisID(AnalysisID PI) const {
assert(ResultPass &&
"getAnalysis*() called on an analysis that was not "
"'required' by pass!");
-
- // Because the AnalysisType may not be a subclass of pass (for
- // AnalysisGroups), we use getAdjustedAnalysisPointer here to potentially
- // adjust the return pointer (because the class may multiply inherit, once
- // from pass, once from AnalysisType).
- return *(AnalysisType*)ResultPass->getAdjustedAnalysisPointer(PI);
+ return *(AnalysisType *)ResultPass;
}
/// getAnalysis<AnalysisType>() - This function is used by subclasses to get
@@ -282,12 +269,7 @@ AnalysisType &Pass::getAnalysisID(AnalysisID PI, Function &F, bool *Changed) {
else
assert(!LocalChanged &&
"A pass trigged a code update but the update status is lost");
-
- // Because the AnalysisType may not be a subclass of pass (for
- // AnalysisGroups), we use getAdjustedAnalysisPointer here to potentially
- // adjust the return pointer (because the class may multiply inherit, once
- // from pass, once from AnalysisType).
- return *(AnalysisType*)ResultPass->getAdjustedAnalysisPointer(PI);
+ return *(AnalysisType *)ResultPass;
}
} // end namespace llvm
diff --git a/llvm/lib/IR/Pass.cpp b/llvm/lib/IR/Pass.cpp
index b1b33a517f0ff..f3ae2e6314429 100644
--- a/llvm/lib/IR/Pass.cpp
+++ b/llvm/lib/IR/Pass.cpp
@@ -107,10 +107,6 @@ void Pass::verifyAnalysis() const {
// By default, don't do anything.
}
-void *Pass::getAdjustedAnalysisPointer(AnalysisID AID) {
- return this;
-}
-
ImmutablePass *Pass::getAsImmutablePass() {
return nullptr;
}
More information about the llvm-commits
mailing list