diff --git a/clang/test/CodeGen/thinlto-distributed-objc-contract-pass.ll b/clang/test/CodeGen/thinlto-distributed-objc-contract-pass.ll index a2a7b62cb7f932..e0256da314306c 100644 --- a/clang/test/CodeGen/thinlto-distributed-objc-contract-pass.ll +++ b/clang/test/CodeGen/thinlto-distributed-objc-contract-pass.ll @@ -4,7 +4,7 @@ ; RUN: -o %t2.index \ ; RUN: -r=%t.o,_use_arc,px -; RUN: %clang_cc1 -triple x86_64-apple-darwin \ +; RUN: %clang_cc1 -O2 -triple x86_64-apple-darwin \ ; RUN: -emit-obj -fthinlto-index=%t.o.thinlto.bc \ ; RUN: -o %t.native.o -x ir %t.o diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index f6217dab262098..d833555d44b258 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -950,7 +950,8 @@ void TargetPassConfig::addCodeGenPrepare() { void TargetPassConfig::addISelPrepare() { addPreISel(); - addPass(createObjCARCContractPass()); + if (getOptLevel() != CodeGenOptLevel::None) + addPass(createObjCARCContractPass()); // Force codegen to run according to the callgraph. if (requiresCodeGenSCCOrder()) diff --git a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp index 72ed57015e0535..0d0f5c72928ab7 100644 --- a/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp +++ b/llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp @@ -71,9 +71,6 @@ class ObjCARCContract { ARCRuntimeEntryPoints EP; BundledRetainClaimRVs *BundledInsts = nullptr; - /// A flag indicating whether this optimization pass should run. - bool Run; - /// The inline asm string to insert between calls and RetainRV calls to make /// the optimization work on targets which need it. const MDString *RVInstMarker; @@ -530,10 +527,6 @@ bool ObjCARCContract::tryToPeepholeInstruction( //===----------------------------------------------------------------------===// bool ObjCARCContract::init(Module &M) { - Run = ModuleHasARC(M); - if (!Run) - return false; - EP.init(&M); // Initialize RVInstMarker. @@ -546,9 +539,6 @@ bool ObjCARCContract::run(Function &F, AAResults *A, DominatorTree *D) { if (!EnableARCOpts) return false; - if (!Run) - return false; - Changed = CFGChanged = false; AA = A; DT = D; diff --git a/llvm/test/CodeGen/AArch64/O0-pipeline.ll b/llvm/test/CodeGen/AArch64/O0-pipeline.ll index 4698168dac00de..78a7b84b8479b5 100644 --- a/llvm/test/CodeGen/AArch64/O0-pipeline.ll +++ b/llvm/test/CodeGen/AArch64/O0-pipeline.ll @@ -32,10 +32,6 @@ ; CHECK-NEXT: AArch64 Stack Tagging ; CHECK-NEXT: SME ABI Pass ; CHECK-NEXT: Exception handling preparation -; CHECK-NEXT: Dominator Tree Construction -; CHECK-NEXT: Basic Alias Analysis (stateless AA impl) -; CHECK-NEXT: Function Alias Analysis Results -; CHECK-NEXT: ObjC ARC contraction ; CHECK-NEXT: Prepare callbr ; CHECK-NEXT: Safe Stack instrumentation pass ; CHECK-NEXT: Insert stack protectors diff --git a/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll b/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll index 61d106fa562914..4f64a6bb898a4c 100644 --- a/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll +++ b/llvm/test/CodeGen/AMDGPU/llc-pipeline.ll @@ -89,9 +89,6 @@ ; GCN-O0-NEXT: AMDGPU Rewrite Undef for PHI ; GCN-O0-NEXT: LCSSA Verifier ; GCN-O0-NEXT: Loop-Closed SSA Form Pass -; GCN-O0-NEXT: Basic Alias Analysis (stateless AA impl) -; GCN-O0-NEXT: Function Alias Analysis Results -; GCN-O0-NEXT: ObjC ARC contraction ; GCN-O0-NEXT: DummyCGSCCPass ; GCN-O0-NEXT: FunctionPass Manager ; GCN-O0-NEXT: Prepare callbr diff --git a/llvm/test/CodeGen/LoongArch/O0-pipeline.ll b/llvm/test/CodeGen/LoongArch/O0-pipeline.ll index c1f3e30cf18352..13f774c96d5b1d 100644 --- a/llvm/test/CodeGen/LoongArch/O0-pipeline.ll +++ b/llvm/test/CodeGen/LoongArch/O0-pipeline.ll @@ -32,10 +32,6 @@ ; CHECK-NEXT: Scalarize Masked Memory Intrinsics ; CHECK-NEXT: Expand reduction intrinsics ; CHECK-NEXT: Exception handling preparation -; CHECK-NEXT: Dominator Tree Construction -; CHECK-NEXT: Basic Alias Analysis (stateless AA impl) -; CHECK-NEXT: Function Alias Analysis Results -; CHECK-NEXT: ObjC ARC contraction ; CHECK-NEXT: Prepare callbr ; CHECK-NEXT: Safe Stack instrumentation pass ; CHECK-NEXT: Insert stack protectors diff --git a/llvm/test/CodeGen/PowerPC/O0-pipeline.ll b/llvm/test/CodeGen/PowerPC/O0-pipeline.ll index 66afbb0a064ca3..cd37bee4592d62 100644 --- a/llvm/test/CodeGen/PowerPC/O0-pipeline.ll +++ b/llvm/test/CodeGen/PowerPC/O0-pipeline.ll @@ -31,10 +31,6 @@ ; CHECK-NEXT: Scalarize Masked Memory Intrinsics ; CHECK-NEXT: Expand reduction intrinsics ; CHECK-NEXT: Exception handling preparation -; CHECK-NEXT: Dominator Tree Construction -; CHECK-NEXT: Basic Alias Analysis (stateless AA impl) -; CHECK-NEXT: Function Alias Analysis Results -; CHECK-NEXT: ObjC ARC contraction ; CHECK-NEXT: Prepare callbr ; CHECK-NEXT: Safe Stack instrumentation pass ; CHECK-NEXT: Insert stack protectors diff --git a/llvm/test/CodeGen/RISCV/O0-pipeline.ll b/llvm/test/CodeGen/RISCV/O0-pipeline.ll index 95e481c80197ef..953eb873b660bb 100644 --- a/llvm/test/CodeGen/RISCV/O0-pipeline.ll +++ b/llvm/test/CodeGen/RISCV/O0-pipeline.ll @@ -32,10 +32,6 @@ ; CHECK-NEXT: Scalarize Masked Memory Intrinsics ; CHECK-NEXT: Expand reduction intrinsics ; CHECK-NEXT: Exception handling preparation -; CHECK-NEXT: Dominator Tree Construction -; CHECK-NEXT: Basic Alias Analysis (stateless AA impl) -; CHECK-NEXT: Function Alias Analysis Results -; CHECK-NEXT: ObjC ARC contraction ; CHECK-NEXT: Prepare callbr ; CHECK-NEXT: Safe Stack instrumentation pass ; CHECK-NEXT: Insert stack protectors diff --git a/llvm/test/CodeGen/X86/O0-pipeline.ll b/llvm/test/CodeGen/X86/O0-pipeline.ll index a137cd39358bca..ca855cfd1ad44e 100644 --- a/llvm/test/CodeGen/X86/O0-pipeline.ll +++ b/llvm/test/CodeGen/X86/O0-pipeline.ll @@ -33,10 +33,6 @@ ; CHECK-NEXT: Expand reduction intrinsics ; CHECK-NEXT: Expand indirectbr instructions ; CHECK-NEXT: Exception handling preparation -; CHECK-NEXT: Dominator Tree Construction -; CHECK-NEXT: Basic Alias Analysis (stateless AA impl) -; CHECK-NEXT: Function Alias Analysis Results -; CHECK-NEXT: ObjC ARC contraction ; CHECK-NEXT: Prepare callbr ; CHECK-NEXT: Safe Stack instrumentation pass ; CHECK-NEXT: Insert stack protectors