[PATCH] D126517: [Propeller] Promote functions with propeller profiles to .text.hot.

Rahman Lavaee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 19:09:53 PDT 2022


rahmanl created this revision.
Herald added subscribers: kosarev, frasercrmck, wenlei, kerbowa, luismarques, apazos, sameer.abuasal, pengfei, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, tpr, mgorny, jvesely, nemanjai.
Herald added a project: All.
rahmanl requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, MaskRay.
Herald added a project: LLVM.

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`.

Fix amdgpu test. Originally reviewed in D122930 <https://reviews.llvm.org/D122930>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126517

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126517.432443.patch
Type: text/x-patch
Size: 35565 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220527/add984ef/attachment-0001.bin>


More information about the llvm-commits mailing list