[all-commits] [llvm/llvm-project] 9b3834: [clang] Fix inline builtin functions of an __asm__...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Wed Nov 2 13:25:52 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9b3834ef67e3f320fe78dd63f6d5f1bafeafba78
      https://github.com/llvm/llvm-project/commit/9b3834ef67e3f320fe78dd63f6d5f1bafeafba78
  Author: Martin Storsjö <martin at martin.st>
  Date:   2022-11-02 (Wed, 02 Nov 2022)

  Changed paths:
    M clang/lib/CodeGen/CGExpr.cpp
    A clang/test/CodeGen/inline-builtin-asm-name.c

  Log Message:
  -----------
  [clang] Fix inline builtin functions of an __asm__ renamed function with symbol prefixes

If a function is renamed with `__asm__`, the name provided is the
exact symbol name, without any extra implicit symbol prefixes.
If the target does use symbol prefixes, the IR level symbol gets
an `\01` prefix to indicate that it's a literal symbol name to be
taken as is.

When a builtin function is specialized by providing an inline
version of it, that inline function is named `<funcname>.inline`.

When the base function has been renamed due to `__asm__`, the inline
function ends up named `<asmname>.inline`. Up to this point,
things did work as expected before.

However, for targets with symbol prefixes, one codepath that produced
the combined name `<asmname>.inline` used the mangled `asmname` with
`\01` prefix, while others didn't. This patch fixes this.

This fixes the combination of asm renamed builtin function, with
inline override of the function, on any target with symbol
prefixes (such as i386 windows and any Darwin target).

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




More information about the All-commits mailing list