[PATCH] D121346: [Propeller] Encode address offsets of basic blocks relative to the end of the previous basic blocks.

Rahman Lavaee via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 10 00:04:06 PST 2022


rahmanl created this revision.
rahmanl added reviewers: amharc, shenhan, jhenderson.
Herald added subscribers: wenlei, pengfei, rupprecht, hiraditya, emaste.
Herald added a project: All.
rahmanl retitled this revision from "Encode address offsets of basic blocks relative to the end of the previous basic blocks." to "[Propeller] Encode address offsets of basic blocks relative to the end of the previous basic blocks.".
rahmanl edited the summary of this revision.
rahmanl updated this revision to Diff 414281.
rahmanl added a comment.
rahmanl published this revision for review.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.

Cleanup.


This is a resurrection of D106421 <https://reviews.llvm.org/D106421> with the change that it keeps backward-compatibility. This means decoding the previous version of `llvm_bb_address_map` will work. This is required as the profile mapping tool is not released with LLVM (AutoFDO). We add a version suffix (`.v#{version_number}`) to the section name which distinguishes it from the old version (which wouldn't have a version suffix).

Conceptually, the new encoding emits basic block offsets and sizes as label differences between each two consecutive basic block begin and end label. When decoding, offsets must be aggregated along with basic block sizes to calculate the final offsets of basic blocks relative to the function address.

This encoding uses smaller values compared to the existing one (offsets relative to function symbol).
Smaller values tend to occupy fewer bytes in ULEB128 encoding. As a result, we get about 25% reduction in the size of the bb-address-map section (from about 9MB to 7MB for the clang PGO binary).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D121346

Files:
  llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
  llvm/lib/CodeGen/BasicBlockSections.cpp
  llvm/lib/MC/MCObjectFileInfo.cpp
  llvm/lib/Object/ELF.cpp
  llvm/test/CodeGen/X86/basic-block-sections-labels-empty-function.ll
  llvm/test/CodeGen/X86/basic-block-sections-labels-functions-sections.ll
  llvm/test/CodeGen/X86/basic-block-sections-labels.ll
  llvm/test/tools/llvm-readobj/ELF/bb-addr-map.test
  llvm/test/tools/obj2yaml/ELF/bb-addr-map.yaml
  llvm/unittests/Object/ELFObjectFileTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121346.414281.patch
Type: text/x-patch
Size: 15379 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220310/1abb39a6/attachment-0001.bin>


More information about the llvm-commits mailing list