[all-commits] [llvm/llvm-project] 434fed: [SampleFDO] Using common linkage for the discrimin...

xur-llvm via All-commits all-commits at lists.llvm.org
Tue Jun 15 14:55:01 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 434fed5aff5e62460e2e984c7cc2674c12779b1e
      https://github.com/llvm/llvm-project/commit/434fed5aff5e62460e2e984c7cc2674c12779b1e
  Author: Rong Xu <xur at google.com>
  Date:   2021-06-15 (Tue, 15 Jun 2021)

  Changed paths:
    M llvm/lib/CodeGen/MIRFSDiscriminator.cpp
    M llvm/test/CodeGen/X86/fsafdo_test1.ll
    M llvm/test/CodeGen/X86/fsafdo_test2.ll

  Log Message:
  -----------
  [SampleFDO] Using common linkage for the discriminator flag variable

We create flag variable "__llvm_fs_discriminator__" in the binary
to indicate that FSAFDO hierarchical discriminators are used.

This variable might be GC'ed by the linker since it is not explicitly
reference. I initially added the var to the use list in pass
MIRFSDiscriminator but it did not work. It turned out the used global
list is collected in lowering (before MIR pass) and then emitted in
the end of pass pipeline.

In this patch, we use a "common" linkage for this variable so that
it will be GC'ed by the linker.

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




More information about the All-commits mailing list