Skip to content

Commit 53ef0a2

Browse files
committed
[IRGen] Move ObjCARCContractPass into performLLVMOptimizations
This seems like something we want to always do, not just when emitting the LLVM module.
1 parent f9d7066 commit 53ef0a2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/IRGen/IRGen.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,13 @@ void swift::performLLVMOptimizations(const IRGenOptions &Opts,
309309
if (Opts.PrintInlineTree)
310310
ModulePasses.add(createInlineTreePrinterPass());
311311

312+
// Make sure we do ARC contraction under optimization. We don't
313+
// rely on any other LLVM ARC transformations, but we do need ARC
314+
// contraction to add the objc_retainAutoreleasedReturnValue
315+
// assembly markers and remove clang.arc.used.
316+
if (Opts.shouldOptimize() && !DisableObjCARCContract)
317+
ModulePasses.add(createObjCARCContractPass());
318+
312319
// Do it.
313320
ModulePasses.run(*Module);
314321

@@ -531,13 +538,6 @@ bool swift::performLLVM(const IRGenOptions &Opts,
531538

532539
legacy::PassManager EmitPasses;
533540

534-
// Make sure we do ARC contraction under optimization. We don't
535-
// rely on any other LLVM ARC transformations, but we do need ARC
536-
// contraction to add the objc_retainAutoreleasedReturnValue
537-
// assembly markers and remove clang.arc.used.
538-
if (Opts.shouldOptimize() && !DisableObjCARCContract)
539-
EmitPasses.add(createObjCARCContractPass());
540-
541541
// Set up the final emission passes.
542542
switch (Opts.OutputKind) {
543543
case IRGenOutputKind::Module:

0 commit comments

Comments
 (0)