[all-commits] [llvm/llvm-project] 634ca7: [ObjCARC] Require the function argument in the cla...

Ahmed Bougacha via All-commits all-commits at lists.llvm.org
Fri Jan 28 12:42:14 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 634ca7349d4a467b993321ff3152c2e044f1f487
      https://github.com/llvm/llvm-project/commit/634ca7349d4a467b993321ff3152c2e044f1f487
  Author: Ahmed Bougacha <ahmed at bougacha.org>
  Date:   2022-01-28 (Fri, 28 Jan 2022)

  Changed paths:
    M llvm/docs/LangRef.rst
    M llvm/include/llvm/Analysis/ObjCARCUtil.h
    M llvm/lib/IR/Verifier.cpp
    M llvm/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp
    M llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
    M llvm/lib/Target/AArch64/AArch64InstrInfo.td
    M llvm/lib/Transforms/ObjCARC/ObjCARC.cpp
    M llvm/lib/Transforms/ObjCARC/ObjCARC.h
    M llvm/lib/Transforms/ObjCARC/ObjCARCContract.cpp
    M llvm/lib/Transforms/ObjCARC/ObjCARCOpts.cpp
    M llvm/test/CodeGen/AArch64/call-rv-marker.ll
    M llvm/test/CodeGen/AArch64/expand-blr-rvmarker-pseudo.mir
    M llvm/test/CodeGen/AArch64/rvmarker-pseudo-expansion-and-outlining.mir
    M llvm/test/CodeGen/X86/call-rv-marker.ll
    M llvm/test/Transforms/ObjCARC/contract-marker-funclet.ll
    M llvm/test/Transforms/ObjCARC/contract-rv-attr.ll
    M llvm/test/Verifier/operand-bundles.ll

  Log Message:
  -----------
  [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




More information about the All-commits mailing list