[all-commits] [llvm/llvm-project] 6cee53: [Clang] Change AnonStructIds in MangleContext to p...

xur-llvm via All-commits all-commits at lists.llvm.org
Sun Oct 23 22:43:41 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6cee5393371fdde798605c88bad0ebceb3626257
      https://github.com/llvm/llvm-project/commit/6cee5393371fdde798605c88bad0ebceb3626257
  Author: Rong Xu <xur at google.com>
  Date:   2022-10-23 (Sun, 23 Oct 2022)

  Changed paths:
    M clang/include/clang/AST/Mangle.h
    M clang/lib/AST/ItaniumMangle.cpp
    M clang/test/CodeGen/attr-function-return.cpp
    M clang/test/CodeGenCXX/catch-undef-behavior.cpp
    M clang/test/CodeGenCXX/cxx1y-init-captures-eh.cpp
    M clang/test/CodeGenCXX/cxx1y-init-captures.cpp
    M clang/test/CodeGenCXX/lambda-expressions-nested-linkage.cpp
    M clang/test/CodeGenCXX/lambda-expressions.cpp
    M clang/test/CodeGenCXX/mangle-lambdas.cpp
    M clang/test/CodeGenCXX/nrvo.cpp
    M clang/test/CodeGenObjCXX/arc-forwarded-lambda-call.mm
    M clang/test/CodeGenObjCXX/block-nested-in-lambda.mm
    M clang/test/CodeGenObjCXX/lambda-expressions.mm
    M clang/test/CodeGenObjCXX/property-lvalue-lambda.mm

  Log Message:
  -----------
  [Clang] Change AnonStructIds in MangleContext to per-function based

Clang is generating different mangled names for the same lambda
function in slightly changed builds (like with non-related
source/Macro change). This is due to the fact that clang uses a
cross-translation-unit sequential string "$_<n>" in lambda's
mangled name. Here, "n" is the AnonStructIds field in MangleContext.

Different mangled names for a unchanged function is undesirable:
it makes perf comparison harder, and can cause some unnecessary
profile mismatch in SampleFDO.

This patch makes mangled name for lambda functions more stable
by changing AnonStructIds to a per-function based seq number if the
DeclContext is a function.

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




More information about the All-commits mailing list