[PATCH] D108581: [CSPGO] Fix lost IRPGOFlag in CSPGO instrumentation

Rong Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 23 13:37:48 PDT 2021


xur created this revision.
xur added reviewers: YolandaCY, MaskRay, rnk.
Herald added subscribers: ormris, wenlei, steven_wu, hiraditya.
xur requested review of this revision.
Herald added a project: LLVM.

The IRPGOFlag symbol (__llvm_profile_raw_version) is dropped when
identified as non-prevailing for either regular or thin LTO during
the mixed-LTO mode compilation.  This happens in the module
where IRPGOFlag is mard as non-prevailing. This variable
is emitted in the final object from the prevailing module.

This is still problematic because we currently query this symbol to coordinate
some actions B/W PGOInstrumentation and InstroProfiling lowering, like
whether to do value profiling, weather to do comdat renaming.

TThis problem is bought up by YolandaCY in
https://reviews.llvm.org/D107034
YolandCY reported unresolved symbol linker errors in CSPGO instrumentation build.

D107034 <https://reviews.llvm.org/D107034> proposed to set a module flag as the fix.

But I think a better way is to let LTO retain IRPGOFlag decl by adding
it to CompilerUsed list and relax the check in isIRPGOFlagSet() when
doing the InstruProfling lowering.

The test case in the patch is from D107034 <https://reviews.llvm.org/D107034>.


https://reviews.llvm.org/D108581

Files:
  llvm/include/llvm/ProfileData/InstrProf.h
  llvm/lib/ProfileData/InstrProf.cpp
  llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
  llvm/test/Transforms/PGOProfile/lto_cspgo_gen.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108581.368195.patch
Type: text/x-patch
Size: 5052 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210823/d342621f/attachment.bin>


More information about the llvm-commits mailing list