[all-commits] [llvm/llvm-project] de620f: [CSPGO] Fix lost IRPGOFlag in CSPGO instrumentation

xur-llvm via All-commits all-commits at lists.llvm.org
Tue Aug 24 09:41:46 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: de620f5b132b2a84e3e4d08afd42682e36527444
      https://github.com/llvm/llvm-project/commit/de620f5b132b2a84e3e4d08afd42682e36527444
  Author: Rong Xu <xur at google.com>
  Date:   2021-08-24 (Tue, 24 Aug 2021)

  Changed paths:
    M llvm/include/llvm/ProfileData/InstrProf.h
    M llvm/lib/ProfileData/InstrProf.cpp
    M llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
    M llvm/test/Transforms/PGOProfile/Inputs/thinlto_cspgo_bar_gen.ll
    A llvm/test/Transforms/PGOProfile/lto_cspgo_gen.ll
    M llvm/test/Transforms/PGOProfile/thinlto_cspgo_gen.ll

  Log Message:
  -----------
  [CSPGO] Fix lost IRPGOFlag in CSPGO instrumentation

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 marked 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 between PGOInstrumentation pass
and InstrProfiling lowering pass, like whether to do value
profiling, whether to do comdat renaming.

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

This patch let LTO retain IRPGOFlag decl by adding it to
CompilerUsed list and relax the check in isIRPGOFlagSet() when
doing the InstrProfiling lowering.

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

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




More information about the All-commits mailing list