[llvm] 5df4ab5 - [llvm] Migrate PAEval to new pass manager
Arthur Eubanks via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 1 16:42:09 PDT 2022
Author: Arthur Eubanks
Date: 2022-10-01T16:41:58-07:00
New Revision: 5df4ab55f9be218886a33790ec97d5106659fc4e
URL: https://github.com/llvm/llvm-project/commit/5df4ab55f9be218886a33790ec97d5106659fc4e
DIFF: https://github.com/llvm/llvm-project/commit/5df4ab55f9be218886a33790ec97d5106659fc4e.diff
LOG: [llvm] Migrate PAEval to new pass manager
Added:
Modified:
llvm/include/llvm/Analysis/Passes.h
llvm/include/llvm/InitializePasses.h
llvm/include/llvm/LinkAllPasses.h
llvm/include/llvm/Transforms/ObjCARC.h
llvm/lib/Passes/PassRegistry.def
llvm/lib/Transforms/ObjCARC/ObjCARC.cpp
llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.h
llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp
llvm/test/Transforms/ObjCARC/provenance.ll
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/Passes.h b/llvm/include/llvm/Analysis/Passes.h
index afca4d057800d..612aca2501f75 100644
--- a/llvm/include/llvm/Analysis/Passes.h
+++ b/llvm/include/llvm/Analysis/Passes.h
@@ -26,8 +26,6 @@ namespace llvm {
//
ImmutablePass *createObjCARCAAWrapperPass();
- FunctionPass *createPAEvalPass();
-
//===--------------------------------------------------------------------===//
//
/// createLazyValueInfoPass - This creates an instance of the LazyValueInfo
diff --git a/llvm/include/llvm/InitializePasses.h b/llvm/include/llvm/InitializePasses.h
index 92ec0594b94b1..3dd8195b83195 100644
--- a/llvm/include/llvm/InitializePasses.h
+++ b/llvm/include/llvm/InitializePasses.h
@@ -324,7 +324,6 @@ void initializeObjCARCExpandPass(PassRegistry&);
void initializeObjCARCOptLegacyPassPass(PassRegistry &);
void initializeOptimizationRemarkEmitterWrapperPassPass(PassRegistry&);
void initializeOptimizePHIsPass(PassRegistry&);
-void initializePAEvalPass(PassRegistry&);
void initializePEIPass(PassRegistry&);
void initializePHIEliminationPass(PassRegistry&);
void initializePartialInlinerLegacyPassPass(PassRegistry&);
diff --git a/llvm/include/llvm/LinkAllPasses.h b/llvm/include/llvm/LinkAllPasses.h
index b934ddbb0ee83..7a11a8f986422 100644
--- a/llvm/include/llvm/LinkAllPasses.h
+++ b/llvm/include/llvm/LinkAllPasses.h
@@ -143,7 +143,6 @@ namespace {
(void) llvm::createObjCARCExpandPass();
(void) llvm::createObjCARCContractPass();
(void) llvm::createObjCARCOptPass();
- (void) llvm::createPAEvalPass();
(void) llvm::createPromoteMemoryToRegisterPass();
(void) llvm::createDemoteRegisterToMemoryPass();
(void)llvm::createPostDomOnlyPrinterWrapperPassPass();
diff --git a/llvm/include/llvm/Transforms/ObjCARC.h b/llvm/include/llvm/Transforms/ObjCARC.h
index a89df95385c85..a4dd696564458 100644
--- a/llvm/include/llvm/Transforms/ObjCARC.h
+++ b/llvm/include/llvm/Transforms/ObjCARC.h
@@ -60,6 +60,10 @@ struct ObjCARCExpandPass : public PassInfoMixin<ObjCARCExpandPass> {
PreservedAnalyses run(Function &M, FunctionAnalysisManager &AM);
};
+struct PAEvalPass : public PassInfoMixin<PAEvalPass> {
+ PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
+};
+
} // End llvm namespace
#endif
diff --git a/llvm/lib/Passes/PassRegistry.def b/llvm/lib/Passes/PassRegistry.def
index cdc286043fa62..8cfb9d6f54afd 100644
--- a/llvm/lib/Passes/PassRegistry.def
+++ b/llvm/lib/Passes/PassRegistry.def
@@ -330,6 +330,7 @@ FUNCTION_PASS("loop-versioning", LoopVersioningPass())
FUNCTION_PASS("objc-arc", ObjCARCOptPass())
FUNCTION_PASS("objc-arc-contract", ObjCARCContractPass())
FUNCTION_PASS("objc-arc-expand", ObjCARCExpandPass())
+FUNCTION_PASS("pa-eval", PAEvalPass())
FUNCTION_PASS("pgo-memop-opt", PGOMemOPSizeOpt())
FUNCTION_PASS("print", PrintFunctionPass(dbgs()))
FUNCTION_PASS("print<assumptions>", AssumptionPrinterPass(dbgs()))
diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARC.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARC.cpp
index 70f150c9461ad..3c2058e566ff9 100644
--- a/llvm/lib/Transforms/ObjCARC/ObjCARC.cpp
+++ b/llvm/lib/Transforms/ObjCARC/ObjCARC.cpp
@@ -35,7 +35,6 @@ void llvm::initializeObjCARCOpts(PassRegistry &Registry) {
initializeObjCARCExpandPass(Registry);
initializeObjCARCContractLegacyPassPass(Registry);
initializeObjCARCOptLegacyPassPass(Registry);
- initializePAEvalPass(Registry);
}
void LLVMInitializeObjCARCOpts(LLVMPassRegistryRef R) {
diff --git a/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.h b/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.h
index 1624cf26094af..bc946fac45444 100644
--- a/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.h
+++ b/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysis.h
@@ -26,6 +26,7 @@
#define LLVM_LIB_TRANSFORMS_OBJCARC_PROVENANCEANALYSIS_H
#include "llvm/ADT/DenseMap.h"
+#include "llvm/IR/PassManager.h"
#include "llvm/IR/ValueHandle.h"
#include <utility>
diff --git a/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp b/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp
index fe637ee066a42..c3d806ef5c0a8 100644
--- a/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp
+++ b/llvm/lib/Transforms/ObjCARC/ProvenanceAnalysisEvaluator.cpp
@@ -7,38 +7,16 @@
//===----------------------------------------------------------------------===//
#include "ProvenanceAnalysis.h"
+#include "llvm/Transforms/ObjCARC.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Analysis/AliasAnalysis.h"
-#include "llvm/Analysis/Passes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/InstIterator.h"
-#include "llvm/IR/InstrTypes.h"
-#include "llvm/IR/Module.h"
-#include "llvm/InitializePasses.h"
-#include "llvm/Pass.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
using namespace llvm::objcarc;
-namespace {
-class PAEval : public FunctionPass {
-
-public:
- static char ID;
- PAEval();
- void getAnalysisUsage(AnalysisUsage &AU) const override;
- bool runOnFunction(Function &F) override;
-};
-}
-
-char PAEval::ID = 0;
-PAEval::PAEval() : FunctionPass(ID) {}
-
-void PAEval::getAnalysisUsage(AnalysisUsage &AU) const {
- AU.addRequired<AAResultsWrapperPass>();
-}
-
static StringRef getName(Value *V) {
StringRef Name = V->getName();
if (Name.startswith("\1"))
@@ -52,7 +30,7 @@ static void insertIfNamed(SetVector<Value *> &Values, Value *V) {
Values.insert(V);
}
-bool PAEval::runOnFunction(Function &F) {
+PreservedAnalyses PAEvalPass::run(Function &F, FunctionAnalysisManager &AM) {
SetVector<Value *> Values;
for (auto &Arg : F.args())
@@ -66,7 +44,7 @@ bool PAEval::runOnFunction(Function &F) {
}
ProvenanceAnalysis PA;
- PA.setAA(&getAnalysis<AAResultsWrapperPass>().getAAResults());
+ PA.setAA(&AM.getResult<AAManager>(F));
for (Value *V1 : Values) {
StringRef NameV1 = getName(V1);
@@ -82,13 +60,5 @@ bool PAEval::runOnFunction(Function &F) {
}
}
- return false;
-}
-
-FunctionPass *llvm::createPAEvalPass() { return new PAEval(); }
-
-INITIALIZE_PASS_BEGIN(PAEval, "pa-eval",
- "Evaluate ProvenanceAnalysis on all pairs", false, true)
-INITIALIZE_PASS_DEPENDENCY(AAResultsWrapperPass)
-INITIALIZE_PASS_END(PAEval, "pa-eval",
- "Evaluate ProvenanceAnalysis on all pairs", false, true)
+ return PreservedAnalyses::all();
+}
\ No newline at end of file
diff --git a/llvm/test/Transforms/ObjCARC/provenance.ll b/llvm/test/Transforms/ObjCARC/provenance.ll
index d5b4f96800340..8970b6c44bd64 100644
--- a/llvm/test/Transforms/ObjCARC/provenance.ll
+++ b/llvm/test/Transforms/ObjCARC/provenance.ll
@@ -1,4 +1,4 @@
-; RUN: opt -disable-output -disable-basic-aa -pa-eval %s -enable-new-pm=0 2>&1 | FileCheck %s
+; RUN: opt -disable-output -aa-pipeline= -passes=pa-eval %s 2>&1 | FileCheck %s
@"\01l_objc_msgSend_fixup_" = global i8 0
@g1 = global i8 0, section "__OBJC,__message_refs,literal_pointers,no_dead_strip"
More information about the llvm-commits
mailing list