[PATCH] D96932: [SampleFDO] Support enabling -funique-internal-linkage-name

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 17 20:41:32 PST 2021


wmi created this revision.
wmi added reviewers: davidxl, wenlei, hoy, tmsriram.
Herald added a subscriber: hiraditya.
wmi requested review of this revision.
Herald added a project: LLVM.

Now we have -funique-internal-linkage-name support, 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.

There are two kinds of possible regressions. One kind of regression is 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 may introduce transient regression. In rare case, user may also want to disable -funique-internal-linkage-name after it has been enabled for a while, to triage something for example. In that case, profile will contain the suffix but IR in the optimized build won't.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D96932

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96932.324509.patch
Type: text/x-patch
Size: 33399 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210218/01efa58a/attachment.bin>


More information about the llvm-commits mailing list