Skip to content

release/21.x [ObjCARC] Delete empty autoreleasepools with no autoreleases in them and remove ObjCARCAPElimPass #150771

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions clang/lib/CodeGen/BackendUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1027,12 +1027,6 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
MPM.addPass(
createModuleToFunctionPassAdaptor(ObjCARCExpandPass()));
});
PB.registerPipelineEarlySimplificationEPCallback(
[](ModulePassManager &MPM, OptimizationLevel Level,
ThinOrFullLTOPhase) {
if (Level != OptimizationLevel::O0)
MPM.addPass(ObjCARCAPElimPass());
});
PB.registerScalarOptimizerLateEPCallback(
[](FunctionPassManager &FPM, OptimizationLevel Level) {
if (Level != OptimizationLevel::O0)
Expand Down
4 changes: 0 additions & 4 deletions llvm/include/llvm/Transforms/ObjCARC.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ struct ObjCARCContractPass : public PassInfoMixin<ObjCARCContractPass> {
LLVM_ABI PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
};

struct ObjCARCAPElimPass : public PassInfoMixin<ObjCARCAPElimPass> {
LLVM_ABI PreservedAnalyses run(Module &M, ModuleAnalysisManager &AM);
};

struct ObjCARCExpandPass : public PassInfoMixin<ObjCARCExpandPass> {
LLVM_ABI PreservedAnalyses run(Function &M, FunctionAnalysisManager &AM);
};
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Passes/PassRegistry.def
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ MODULE_PASS("module-inline", ModuleInlinerPass())
MODULE_PASS("name-anon-globals", NameAnonGlobalPass())
MODULE_PASS("no-op-module", NoOpModulePass())
MODULE_PASS("nsan", NumericalStabilitySanitizerPass())
MODULE_PASS("objc-arc-apelim", ObjCARCAPElimPass())
MODULE_PASS("openmp-opt", OpenMPOptPass())
MODULE_PASS("openmp-opt-postlink",
OpenMPOptPass(ThinOrFullLTOPhase::FullLTOPostLink))
Expand Down
16 changes: 16 additions & 0 deletions llvm/lib/Transforms/ObjCARC/ARCRuntimeEntryPoints.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ enum class ARCRuntimeEntryPointKind {
UnsafeClaimRV,
RetainAutorelease,
RetainAutoreleaseRV,
AutoreleasePoolPush,
AutoreleasePoolPop,
};

/// Declarations for ObjC runtime functions and constants. These are initialized
Expand All @@ -67,6 +69,8 @@ class ARCRuntimeEntryPoints {
UnsafeClaimRV = nullptr;
RetainAutorelease = nullptr;
RetainAutoreleaseRV = nullptr;
AutoreleasePoolPush = nullptr;
AutoreleasePoolPop = nullptr;
}

Function *get(ARCRuntimeEntryPointKind kind) {
Expand Down Expand Up @@ -101,6 +105,12 @@ class ARCRuntimeEntryPoints {
case ARCRuntimeEntryPointKind::RetainAutoreleaseRV:
return getIntrinsicEntryPoint(RetainAutoreleaseRV,
Intrinsic::objc_retainAutoreleaseReturnValue);
case ARCRuntimeEntryPointKind::AutoreleasePoolPush:
return getIntrinsicEntryPoint(AutoreleasePoolPush,
Intrinsic::objc_autoreleasePoolPush);
case ARCRuntimeEntryPointKind::AutoreleasePoolPop:
return getIntrinsicEntryPoint(AutoreleasePoolPop,
Intrinsic::objc_autoreleasePoolPop);
}

llvm_unreachable("Switch should be a covered switch.");
Expand Down Expand Up @@ -143,6 +153,12 @@ class ARCRuntimeEntryPoints {
/// Declaration for objc_retainAutoreleaseReturnValue().
Function *RetainAutoreleaseRV = nullptr;

/// Declaration for objc_autoreleasePoolPush().
Function *AutoreleasePoolPush = nullptr;

/// Declaration for objc_autoreleasePoolPop().
Function *AutoreleasePoolPop = nullptr;

Function *getIntrinsicEntryPoint(Function *&Decl, Intrinsic::ID IntID) {
if (Decl)
return Decl;
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Transforms/ObjCARC/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ add_llvm_component_library(LLVMObjCARCOpts
ObjCARC.cpp
ObjCARCOpts.cpp
ObjCARCExpand.cpp
ObjCARCAPElim.cpp
ObjCARCContract.cpp
DependencyAnalysis.cpp
ProvenanceAnalysis.cpp
Expand Down
156 changes: 0 additions & 156 deletions llvm/lib/Transforms/ObjCARC/ObjCARCAPElim.cpp

This file was deleted.

Loading
Loading