1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

[NewPM] Run ObjC ARC passes

Match the legacy PM in running various ObjC ARC passes.

This requires making some module passes into function passes. These were
initially ported as module passes since they add function declarations
(e.g. https://reviews.llvm.org/D86178), but that's still up for debate
and other passes do so.

Reviewed By: ahatanak

Differential Revision: https://reviews.llvm.org/D93743
This commit is contained in:
Arthur Eubanks 2020-12-22 21:41:25 -08:00
parent 3533461f4c
commit 29f461772d
4 changed files with 13 additions and 24 deletions

View File

@ -45,11 +45,11 @@ Pass *createObjCARCContractPass();
Pass *createObjCARCOptPass();
struct ObjCARCOptPass : public PassInfoMixin<ObjCARCOptPass> {
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
};
struct ObjCARCContractPass : public PassInfoMixin<ObjCARCContractPass> {
PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
};
struct ObjCARCAPElimPass : public PassInfoMixin<ObjCARCAPElimPass> {

View File

@ -80,9 +80,7 @@ MODULE_PASS("metarenamer", MetaRenamerPass())
MODULE_PASS("mergefunc", MergeFunctionsPass())
MODULE_PASS("name-anon-globals", NameAnonGlobalPass())
MODULE_PASS("no-op-module", NoOpModulePass())
MODULE_PASS("objc-arc", ObjCARCOptPass())
MODULE_PASS("objc-arc-apelim", ObjCARCAPElimPass())
MODULE_PASS("objc-arc-contract", ObjCARCContractPass())
MODULE_PASS("partial-inliner", PartialInlinerPass())
MODULE_PASS("pgo-icall-prom", PGOIndirectCallPromotion())
MODULE_PASS("pgo-instr-gen", PGOInstrumentationGen())
@ -268,6 +266,8 @@ FUNCTION_PASS("loop-load-elim", LoopLoadEliminationPass())
FUNCTION_PASS("loop-fusion", LoopFusePass())
FUNCTION_PASS("loop-distribute", LoopDistributePass())
FUNCTION_PASS("loop-versioning", LoopVersioningPass())
FUNCTION_PASS("objc-arc", ObjCARCOptPass())
FUNCTION_PASS("objc-arc-contract", ObjCARCContractPass())
FUNCTION_PASS("objc-arc-expand", ObjCARCExpandPass())
FUNCTION_PASS("pgo-memop-opt", PGOMemOPSizeOpt())
FUNCTION_PASS("print", PrintFunctionPass(dbgs()))

View File

@ -750,19 +750,13 @@ bool ObjCARCContractLegacyPass::runOnFunction(Function &F) {
return OCARCC.run(F, AA, DT);
}
PreservedAnalyses ObjCARCContractPass::run(Module &M,
ModuleAnalysisManager &AM) {
PreservedAnalyses ObjCARCContractPass::run(Function &F,
FunctionAnalysisManager &AM) {
ObjCARCContract OCAC;
OCAC.init(M);
OCAC.init(*F.getParent());
auto &FAM = AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
bool Changed = false;
for (Function &F : M) {
if (F.isDeclaration())
continue;
Changed |= OCAC.run(F, &FAM.getResult<AAManager>(F),
&FAM.getResult<DominatorTreeAnalysis>(F));
}
bool Changed = OCAC.run(F, &AM.getResult<AAManager>(F),
&AM.getResult<DominatorTreeAnalysis>(F));
if (Changed) {
PreservedAnalyses PA;
PA.preserveSet<CFGAnalyses>();

View File

@ -2462,17 +2462,12 @@ void ObjCARCOpt::releaseMemory() {
/// @}
///
PreservedAnalyses ObjCARCOptPass::run(Module &M, ModuleAnalysisManager &AM) {
PreservedAnalyses ObjCARCOptPass::run(Function &F,
FunctionAnalysisManager &AM) {
ObjCARCOpt OCAO;
OCAO.init(M);
OCAO.init(*F.getParent());
auto &FAM = AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
bool Changed = false;
for (Function &F : M) {
if (F.isDeclaration())
continue;
Changed |= OCAO.run(F, FAM.getResult<AAManager>(F));
}
bool Changed = OCAO.run(F, AM.getResult<AAManager>(F));
if (Changed) {
PreservedAnalyses PA;
PA.preserveSet<CFGAnalyses>();