[all-commits] [llvm/llvm-project] 0f0e31: Update inline builtin handling to honor gnu inline...

serge-sans-paille via All-commits all-commits at lists.llvm.org
Mon Oct 4 13:26:46 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0f0e31cf511def3e92244e615b2646c1fd0df0cd
      https://github.com/llvm/llvm-project/commit/0f0e31cf511def3e92244e615b2646c1fd0df0cd
  Author: serge-sans-paille <sguelton at redhat.com>
  Date:   2021-10-04 (Mon, 04 Oct 2021)

  Changed paths:
    M clang/lib/AST/Decl.cpp
    M clang/lib/CodeGen/CGExpr.cpp
    M clang/lib/CodeGen/CodeGenFunction.cpp
    A clang/test/CodeGen/memcmp-inline-builtin-to-asm.c
    A clang/test/CodeGen/memcpy-inline-builtin-no-extern.c
    M clang/test/CodeGen/memcpy-inline-builtin.c
    M clang/test/CodeGen/memcpy-nobuiltin.c
    M clang/test/CodeGen/memcpy-nobuiltin.inc
    M clang/test/CodeGen/pr9614.c

  Log Message:
  -----------
  Update inline builtin handling to honor gnu inline attribute

Per the GCC info page:

    If the function is declared 'extern', then this definition of the
    function is used only for inlining.  In no case is the function
    compiled as a standalone function, not even if you take its address
    explicitly.  Such an address becomes an external reference, as if
    you had only declared the function, and had not defined it.

Respect that behavior for inline builtins: keep the original definition, and
generate a copy of the declaration suffixed by '.inline' that's only referenced
in direct call.

This fixes holes in c3717b6858d32d64514a187ede1a77be8ba4e542.

Differential Revision: https://reviews.llvm.org/D111009




More information about the All-commits mailing list