[PATCH] D62433: [ObjC][ARC] Delete ObjC runtime calls if the argument is a global variable

Akira Hatanaka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 24 15:48:42 PDT 2019


ahatanak created this revision.
ahatanak added reviewers: rjmccall, erik.pilkington, pete.
ahatanak added a project: LLVM.
Herald added subscribers: dexonsmith, jkorous.

AFAIK, the only time clang emits runtime calls like `objc_retain` or `objc_release` on a global variable is when the object is a string literal or a global block and retaining or releasing them is a no-op since `NSConstantString` and `__NSGlobalBlock` are retain-agnostic. This patch teaches ARC optimizer to delete the calls when the call argument is a global variable.

rdar://problem/49839633


Repository:
  rL LLVM

https://reviews.llvm.org/D62433

Files:
  include/llvm/Analysis/ObjCARCInstKind.h
  lib/Analysis/ObjCARCInstKind.cpp
  lib/Transforms/ObjCARC/ObjCARCOpts.cpp
  test/Transforms/ObjCARC/global.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62433.201348.patch
Type: text/x-patch
Size: 5991 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190524/be086927/attachment.bin>


More information about the llvm-commits mailing list