llvm-project/llvm/lib/Transforms/ObjCARC
Ahmed Bougacha 634ca7349d [ObjCARC] Require the function argument in the clang.arc.attachedcall bundle.
Currently, the clang.arc.attachedcall bundle takes an optional function
argument.  Depending on whether the argument is present, calls with this
bundle have the following semantics:

- on x86, with the argument present, the call is lowered to:
    call _target
    mov rax, rdi
    call _objc_retainAutoreleasedReturnValue

- on AArch64, without the argument, the call is lowered to:
    bl _target
    mov x29, x29

  and the objc runtime call is expected to be emitted separately.

That's because, on x86, the objc runtime checks for both the mov and
the call on x86, and treats the combination as the ARC autorelease elision
marker.

But on AArch64, it only checks for the dedicated NOP marker, as that's
historically been sufficiently unique.  Thanks to that, the runtime call
wasn't required to be adjacent to the NOP marker, so it wasn't emitted
as part of the bundle sequence.

This patch unifies both architectures: on AArch64, we now emit all
3 instructions for the bundle.  This guarantees that the runtime call
is adjacent to the marker in the sequence, and that's information the
runtime can use to further optimize this.

This helps simplify some of the handling, in particular
BundledRetainClaimRVs, which no longer needs to know whether the bundle
is sufficient or not: it now always should be.

Note that this does not include an AutoUpgrade for the nullary bundles,
as they are only produced in ObjCContract as part of the obj/asm emission
pipeline, and are not expected to be in bitcode.

Differential Revision: https://reviews.llvm.org/D118214
2022-01-28 12:41:45 -08:00
..
ARCRuntimeEntryPoints.h [ObjCARC] Use "UnsafeClaimRV" to refer to unsafeClaim in enums. NFC. 2022-01-24 19:37:01 -08:00
BlotMapVector.h
CMakeLists.txt
DependencyAnalysis.cpp [ObjCARC] Remove unused RetainRVDep dependency kind. NFC. 2022-01-24 19:37:01 -08:00
DependencyAnalysis.h [ObjCARC] Remove unused RetainRVDep dependency kind. NFC. 2022-01-24 19:37:01 -08:00
ObjCARC.cpp [ObjCARC] Require the function argument in the clang.arc.attachedcall bundle. 2022-01-28 12:41:45 -08:00
ObjCARC.h [ObjCARC] Require the function argument in the clang.arc.attachedcall bundle. 2022-01-28 12:41:45 -08:00
ObjCARCAPElim.cpp [Transforms] Use make_early_inc_range (NFC) 2021-09-15 19:55:24 -07:00
ObjCARCContract.cpp [ObjCARC] Require the function argument in the clang.arc.attachedcall bundle. 2022-01-28 12:41:45 -08:00
ObjCARCExpand.cpp [llvm] Use range-based for loops with instructions (NFC) 2021-11-14 19:40:48 -08:00
ObjCARCOpts.cpp [ObjCARC] Require the function argument in the clang.arc.attachedcall bundle. 2022-01-28 12:41:45 -08:00
ProvenanceAnalysis.cpp [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
ProvenanceAnalysis.h [llvm] Remove unused forward declarations (NFC) 2022-01-07 20:00:34 -08:00
ProvenanceAnalysisEvaluator.cpp [llvm] Use range-based for loops with instructions (NFC) 2021-11-14 19:40:48 -08:00
PtrState.cpp Move ObjCARCUtil.h back to llvm/Analysis 2021-03-08 16:35:24 -08:00
PtrState.h