[all-commits] [llvm/llvm-project] 4d8d25: [Propeller] Promote functions with propeller profi...

Rahman Lavaee via All-commits all-commits at lists.llvm.org
Thu May 26 16:23:49 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4d8d2580c53e130c3c3dd3877384301e3c495554
      https://github.com/llvm/llvm-project/commit/4d8d2580c53e130c3c3dd3877384301e3c495554
  Author: Rahman Lavaee <rahmanl at google.com>
  Date:   2022-05-26 (Thu, 26 May 2022)

  Changed paths:
    A llvm/include/llvm/CodeGen/BasicBlockSectionsProfileReader.h
    M llvm/include/llvm/CodeGen/Passes.h
    M llvm/include/llvm/InitializePasses.h
    M llvm/lib/CodeGen/BasicBlockSections.cpp
    A llvm/lib/CodeGen/BasicBlockSectionsProfileReader.cpp
    M llvm/lib/CodeGen/CMakeLists.txt
    M llvm/lib/CodeGen/CodeGenPrepare.cpp
    M llvm/lib/CodeGen/TargetPassConfig.cpp
    M llvm/test/CodeGen/AArch64/O3-pipeline.ll
    M llvm/test/CodeGen/AMDGPU/llc-pipeline.ll
    M llvm/test/CodeGen/PowerPC/O3-pipeline.ll
    M llvm/test/CodeGen/RISCV/O3-pipeline.ll
    M llvm/test/CodeGen/X86/basic-block-sections-cold.ll
    M llvm/test/CodeGen/X86/basic-block-sections-list.ll
    M llvm/test/CodeGen/X86/basic-block-sections-listbb.ll
    M llvm/test/CodeGen/X86/basic-block-sections-source-drift.ll
    M llvm/test/CodeGen/X86/opt-pipeline.ll

  Log Message:
  -----------
  [Propeller] Promote functions with propeller profiles to .text.hot.

Today, text section prefixes (none, .unlikely, .hot, and .unkown) are determined based on PGO profile. However, Propeller may deem a function hot when PGO doesn't. Besides, when `-Wl,-keep-text-section-prefix=true` Propeller cannot enforce a global section ordering as the linker can only reorder sections within each output section (.text, .text.hot, .text.unlikely).

This patch promotes all functions with Propeller profiles (functions listed in the basic-block-sections profile) to .text.hot. The feature is hidden behind the flag `--bbsections-guided-section-prefix` which defaults to `true`.

The new implementation refactors the parsing of basic block sections profile into a new `BasicBlockSectionsProfileReader` analysis pass. This allows us to use the information earlier in `CodeGenPrepare` in order to set the functions text prefix. `BasicBlockSectionsProfileReader` will be used both by `BasicBlockSections` pass and `CodeGenPrepare`.

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




More information about the All-commits mailing list