Commit 19005035 authored by Akira Hatanaka's avatar Akira Hatanaka
Browse files

[ObjC][ARC] Use operand bundle 'clang.arc.attachedcall' instead of

explicitly emitting retainRV or claimRV calls in the IR

This reapplies ed4718ec, which was reverted
because it was causing a miscompile. The bug that was causing the miscompile
has been fixed in 75805dce.

Original commit message:

Background:

This fixes a longstanding problem where llvm breaks ARC's autorelease
optimization (see the link below) by separating calls from the marker
instructions or retainRV/claimRV calls. The backend changes are in
https://reviews.llvm.org/D92569.

https://clang.llvm.org/docs/AutomaticReferenceCounting.html#arc-runtime-objc-autoreleasereturnvalue

What this patch does to fix the problem:

- The front-end adds operand bundle "clang.arc.attachedcall" to calls,
  which indicates the call is implicitly followed by a marker
  instruction and an implicit retainRV/claimRV call that consumes the
  call result. In addition, it emits a call to
  @llvm.ob...
parent 7479a2e0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment