Skip to content

[NewPM] Remove AAEval Legacy Pass #71358

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 7, 2023

Conversation

boomanaiden154
Copy link
Contributor

This patch removes the AAEval legacy pass and associated plumbing. This pass was migrated over to the new pass manager about 11 years ago at this point and there are currently no in-tree users of the legacy pass, so it's essentially just dead code and is completely untested.

@llvmbot
Copy link
Member

llvmbot commented Nov 6, 2023

@llvm/pr-subscribers-llvm-analysis

Author: Aiden Grossman (boomanaiden154)

Changes

This patch removes the AAEval legacy pass and associated plumbing. This pass was migrated over to the new pass manager about 11 years ago at this point and there are currently no in-tree users of the legacy pass, so it's essentially just dead code and is completely untested.


Full diff: https://github.com/llvm/llvm-project/pull/71358.diff

5 Files Affected:

  • (modified) llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h (-7)
  • (modified) llvm/include/llvm/InitializePasses.h (-1)
  • (modified) llvm/include/llvm/LinkAllPasses.h (-1)
  • (modified) llvm/lib/Analysis/AliasAnalysisEvaluator.cpp (-42)
  • (modified) llvm/lib/Analysis/Analysis.cpp (-1)
diff --git a/llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h b/llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h
index 113115b871448b2..20bcbc592afbdbf 100644
--- a/llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h
+++ b/llvm/include/llvm/Analysis/AliasAnalysisEvaluator.h
@@ -54,15 +54,8 @@ class AAEvaluator : public PassInfoMixin<AAEvaluator> {
   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
 
 private:
-  // Allow the legacy pass to run this using an internal API.
-  friend class AAEvalLegacyPass;
-
   void runInternal(Function &F, AAResults &AA);
 };
-
-/// Create a wrapper of the above for the legacy pass manager.
-FunctionPass *createAAEvalPass();
-
 }
 
 #endif
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index fafae8b5ecd7a7f..da38a38b87ebc4d 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -48,7 +48,6 @@ void initializeGlobalISel(PassRegistry&);
 /// Initialize all passes linked into the CodeGen library.
 void initializeTarget(PassRegistry&);
 
-void initializeAAEvalLegacyPassPass(PassRegistry&);
 void initializeAAResultsWrapperPassPass(PassRegistry&);
 void initializeAlwaysInlinerLegacyPassPass(PassRegistry&);
 void initializeAssignmentTrackingAnalysisPass(PassRegistry &);
diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index 141b5420b925ca8..0e61a7f413fe24e 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -61,7 +61,6 @@ namespace {
       if (std::getenv("bar") != (char*) -1)
         return;
 
-      (void) llvm::createAAEvalPass();
       (void) llvm::createBasicAAWrapperPass();
       (void) llvm::createSCEVAAWrapperPass();
       (void) llvm::createTypeBasedAAWrapperPass();
diff --git a/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp b/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp
index a551ea6b69c5a40..6bfba46f1e96fd0 100644
--- a/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp
+++ b/llvm/lib/Analysis/AliasAnalysisEvaluator.cpp
@@ -319,45 +319,3 @@ AAEvaluator::~AAEvaluator() {
            << "%/" << ModRefCount * 100 / ModRefSum << "%\n";
   }
 }
-
-namespace llvm {
-class AAEvalLegacyPass : public FunctionPass {
-  std::unique_ptr<AAEvaluator> P;
-
-public:
-  static char ID; // Pass identification, replacement for typeid
-  AAEvalLegacyPass() : FunctionPass(ID) {
-    initializeAAEvalLegacyPassPass(*PassRegistry::getPassRegistry());
-  }
-
-  void getAnalysisUsage(AnalysisUsage &AU) const override {
-    AU.addRequired<AAResultsWrapperPass>();
-    AU.setPreservesAll();
-  }
-
-  bool doInitialization(Module &M) override {
-    P.reset(new AAEvaluator());
-    return false;
-  }
-
-  bool runOnFunction(Function &F) override {
-    P->runInternal(F, getAnalysis<AAResultsWrapperPass>().getAAResults());
-    return false;
-  }
-  bool doFinalization(Module &M) override {
-    P.reset();
-    return false;
-  }
-};
-}
-
-char AAEvalLegacyPass::ID = 0;
-INITIALIZE_PASS_BEGIN(AAEvalLegacyPass, "aa-eval",
-                      "Exhaustive Alias Analysis Precision Evaluator", false,
-                      true)
-INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
-INITIALIZE_PASS_END(AAEvalLegacyPass, "aa-eval",
-                    "Exhaustive Alias Analysis Precision Evaluator", false,
-                    true)
-
-FunctionPass *llvm::createAAEvalPass() { return new AAEvalLegacyPass(); }
diff --git a/llvm/lib/Analysis/Analysis.cpp b/llvm/lib/Analysis/Analysis.cpp
index 5461ce07af0b9f4..80ea80303644449 100644
--- a/llvm/lib/Analysis/Analysis.cpp
+++ b/llvm/lib/Analysis/Analysis.cpp
@@ -18,7 +18,6 @@ using namespace llvm;
 
 /// initializeAnalysis - Initialize all passes linked into the Analysis library.
 void llvm::initializeAnalysis(PassRegistry &Registry) {
-  initializeAAEvalLegacyPassPass(Registry);
   initializeBasicAAWrapperPassPass(Registry);
   initializeBlockFrequencyInfoWrapperPassPass(Registry);
   initializeBranchProbabilityInfoWrapperPassPass(Registry);

Copy link
Member

@MaskRay MaskRay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Removing a legacy pass usually involves ~5 files.

@bjope
Copy link
Collaborator

bjope commented Nov 6, 2023

One thing people always forget when dropping support for legacy PM is to remove unneeded includes. I think that you no longer need (at least) these in AliasAnalysisEvaluator.cpp:

  #include "llvm/InitializePasses.h"
  #include "llvm/Pass.h"

@bjope bjope closed this Nov 6, 2023
@bjope bjope reopened this Nov 6, 2023
@bjope
Copy link
Collaborator

bjope commented Nov 6, 2023

(Oops... I just wanted to Comment, but acccidentally pressed "Close with comment" instead of "Comment".)

This patch removes the AAEval legacy pass and associated plumbing. This
pass was migrated over to the new pass manager about 11 years ago at
this point and there are currently no in-tree users of the legacy pass,
so it's essentially just dead code.
@boomanaiden154 boomanaiden154 force-pushed the remove-aaeval-legacy-pass branch from b0eb183 to 556e8c3 Compare November 7, 2023 05:42
@boomanaiden154
Copy link
Contributor Author

One thing people always forget when dropping support for legacy PM is to remove unneeded includes. I think that you no longer need (at least) these in AliasAnalysisEvaluator.cpp:

  #include "llvm/InitializePasses.h"
  #include "llvm/Pass.h"

Fixed in the latest revision. Thanks for catching this!

@boomanaiden154 boomanaiden154 merged commit 02230e1 into llvm:main Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants