[all-commits] [llvm/llvm-project] ee3578: [SampleFDO] Support enabling -funique-internal-lin...

wmi-11 via All-commits all-commits at lists.llvm.org
Tue Mar 9 21:42:14 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ee35784a909b318c686f94d53226d2c679ac041c
      https://github.com/llvm/llvm-project/commit/ee35784a909b318c686f94d53226d2c679ac041c
  Author: Wei Mi <wmi at google.com>
  Date:   2021-03-09 (Tue, 09 Mar 2021)

  Changed paths:
    M llvm/include/llvm/ProfileData/SampleProf.h
    M llvm/include/llvm/ProfileData/SampleProfReader.h
    M llvm/lib/ProfileData/SampleProf.cpp
    M llvm/lib/ProfileData/SampleProfReader.cpp
    M llvm/lib/ProfileData/SampleProfWriter.cpp
    M llvm/lib/Transforms/IPO/SampleContextTracker.cpp
    M llvm/lib/Transforms/IPO/SampleProfile.cpp
    A llvm/test/Transforms/SampleProfile/Inputs/uniqname.nosuffix.afdo
    A llvm/test/Transforms/SampleProfile/Inputs/uniqname.suffix.afdo
    A llvm/test/Transforms/SampleProfile/Inputs/uniqname.suffix.prof
    A llvm/test/Transforms/SampleProfile/uniqname.ll
    M llvm/unittests/ProfileData/SampleProfTest.cpp

  Log Message:
  -----------
  [SampleFDO] Support enabling -funique-internal-linkage-name.

now -funique-internal-linkage-name flag is available, and we want to flip
it on by default since it is beneficial to have separate sample profiles
for different internal symbols with the same name. As a preparation, we
want to avoid regression caused by the flip.

When we flip -funique-internal-linkage-name on, the profile is collected
from binary built without -funique-internal-linkage-name so it has no uniq
suffix, but the IR in the optimized build contains the suffix. This kind of
mismatch may introduce transient regression.

To avoid such mismatch, we introduce a NameTable section flag indicating
whether there is any name in the profile containing uniq suffix. Compiler
will decide whether to keep uniq suffix during name canonicalization
depending on the NameTable section flag. The flag is only available for
extbinary format. For other formats, by default compiler will keep uniq
suffix so they will only experience transient regression when
-funique-internal-linkage-name is just flipped.

Another type of regression is caused by places where we miss to call
getCanonicalFnName. Those places are fixed.

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




More information about the All-commits mailing list