[PATCH] D158258: [ThinLTO] Add -objc-arc-contract pass

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 18 01:04:40 PDT 2023


EShuman created this revision.
EShuman added a reviewer: tejohnson.
Herald added subscribers: ormris, steven_wu, hiraditya, inglorion.
Herald added a project: All.
EShuman requested review of this revision.
Herald added a project: LLVM.

Add the -objc-arc-contract pass to enable distributed ThinLTO compilation of sources containing ARC.
The details are here – https://discourse.llvm.org/t/objective-c-and-distributed-thinlto/72482

I need a hand in creating a test (test case file is in attachment)F28730774: reverse.o.ll <https://reviews.llvm.org/F28730774>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D158258

Files:
  llvm/lib/LTO/LTOBackend.cpp


Index: llvm/lib/LTO/LTOBackend.cpp
===================================================================
--- llvm/lib/LTO/LTOBackend.cpp
+++ llvm/lib/LTO/LTOBackend.cpp
@@ -42,6 +42,7 @@
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/TargetParser/SubtargetFeature.h"
 #include "llvm/Transforms/IPO/WholeProgramDevirt.h"
+#include "llvm/Transforms/ObjCARC.h"
 #include "llvm/Transforms/Scalar/LoopPassManager.h"
 #include "llvm/Transforms/Utils/FunctionImportUtils.h"
 #include "llvm/Transforms/Utils/SplitModule.h"
@@ -410,6 +411,13 @@
       createImmutableModuleSummaryIndexWrapperPass(&CombinedIndex));
   if (Conf.PreCodeGenPassesHook)
     Conf.PreCodeGenPassesHook(CodeGenPasses);
+
+  // Add ObjC ARC final-cleanup optimizations. This is done as part of the
+  // "codegen" passes so that it isn't run multiple times when there is
+  // inlining happening.
+  if (Conf.OptLevel > 0)
+    CodeGenPasses.add(createObjCARCContractPass());
+
   if (TM->addPassesToEmitFile(CodeGenPasses, *Stream->OS,
                               DwoOut ? &DwoOut->os() : nullptr,
                               Conf.CGFileType))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D158258.551412.patch
Type: text/x-patch
Size: 1125 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230818/cd607d81/attachment.bin>


More information about the llvm-commits mailing list