[all-commits] [llvm/llvm-project] 5ab6ee: Fix a variety of bugs with nil-receiver checks whe...

John McCall via All-commits all-commits at lists.llvm.org
Fri Oct 8 02:44:19 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5ab6ee75994d645725264e757d67bbb1c96fb2b6
      https://github.com/llvm/llvm-project/commit/5ab6ee75994d645725264e757d67bbb1c96fb2b6
  Author: John McCall <rjmccall at apple.com>
  Date:   2021-10-08 (Fri, 08 Oct 2021)

  Changed paths:
    M clang/include/clang/AST/DeclObjC.h
    M clang/lib/AST/Decl.cpp
    M clang/lib/AST/DeclObjC.cpp
    M clang/lib/CodeGen/CGObjCGNU.cpp
    M clang/lib/CodeGen/CGObjCMac.cpp
    M clang/lib/CodeGen/CGObjCRuntime.cpp
    M clang/lib/CodeGen/CGObjCRuntime.h
    A clang/test/CodeGenObjC/gnu-nil-receiver.m

  Log Message:
  -----------
  Fix a variety of bugs with nil-receiver checks when targeting
non-Darwin ObjC runtimes:

- Use the same logic the Darwin runtime does for inferring that a
  receiver is non-null and therefore doesn't require null checks.
  Previously we weren't skipping these for non-super dispatch.

- Emit a null check when there's a consumed parameter so that we can
  destroy the argument if the call doesn't happen.  This mostly
  involves extracting some common logic from the Darwin-runtime code.

- Generate a zero aggregate by zeroing the same memory that was used
  in the method call instead of zeroing separate memory and then
  merging them with a phi.  This uses less memory and avoids unnecessary
  copies.

- Emit zero initialization, and generate zero values in phis, using
  the proper zero-value routines instead of assuming that the zero
  value of the result type has a bitwise-zero representation.




More information about the All-commits mailing list