[all-commits] [llvm/llvm-project] 3d53b5: [SanitizerBinaryMetadata] Optimize used space for ...

Marco Elver via All-commits all-commits at lists.llvm.org
Wed Feb 8 04:13:00 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3d53b52730034b9ec78871b8dcde8287dd811016
      https://github.com/llvm/llvm-project/commit/3d53b52730034b9ec78871b8dcde8287dd811016
  Author: Marco Elver <elver at google.com>
  Date:   2023-02-08 (Wed, 08 Feb 2023)

  Changed paths:
    M clang/test/CodeGen/sanitize-metadata.c
    M compiler-rt/test/metadata/common.h
    M compiler-rt/test/metadata/covered.cpp
    M compiler-rt/test/metadata/lit.site.cfg.py.in
    M compiler-rt/test/metadata/uar.cpp
    M llvm/include/llvm/Transforms/Instrumentation/SanitizerBinaryMetadata.h
    M llvm/lib/CodeGen/SanitizerBinaryMetadata.cpp
    M llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
    M llvm/test/Instrumentation/SanitizerBinaryMetadata/atomics.ll

  Log Message:
  -----------
  [SanitizerBinaryMetadata] Optimize used space for features and UAR stack args

Optimize the encoding of "covered" metadata by:

 1. Reducing feature mask from 4 bytes to 1 byte (needs increase once we
    reach more than 8 features).

 2. Only emitting UAR stack args size if it is non-zero, saving 4 bytes
    in the common case.

One caveat is that the emitted metadata for function PC (offset), size,
and UAR size (if enabled) are no longer aligned to 4 bytes.

SanitizerBinaryMetadata version base is increased to 2, since the change
is backwards incompatible.

Reviewed By: dvyukov

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


  Commit: bf9814b70560637e322056135fb9a8e3c650e828
      https://github.com/llvm/llvm-project/commit/bf9814b70560637e322056135fb9a8e3c650e828
  Author: Marco Elver <elver at google.com>
  Date:   2023-02-08 (Wed, 08 Feb 2023)

  Changed paths:
    M clang/test/CodeGen/sanitize-metadata.c
    M compiler-rt/test/metadata/common.h
    M llvm/docs/PCSectionsMetadata.rst
    M llvm/include/llvm/CodeGen/AsmPrinter.h
    M llvm/include/llvm/Transforms/Instrumentation/SanitizerBinaryMetadata.h
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    M llvm/lib/CodeGen/AsmPrinter/AsmPrinterDwarf.cpp
    M llvm/lib/CodeGen/SanitizerBinaryMetadata.cpp
    M llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
    M llvm/test/CodeGen/X86/pcsections.ll
    M llvm/test/Instrumentation/SanitizerBinaryMetadata/atomics.ll

  Log Message:
  -----------
  [SanitizerBinaryMetadata] Emit constants as ULEB128

Emit all constant integers produced by SanitizerBinaryMetadata as
ULEB128 to further reduce binary space used. Increasing the version is
not necessary given this change depends on (and will land) along with
the bump to v2.

To support this, the !pcsections metadata format is extended to allow
for per-section options, encoded in the first MD operator which must
always be a string and contain the section: "<section>!<options>".

Reviewed By: dvyukov

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


Compare: https://github.com/llvm/llvm-project/compare/938fdfc40f7e...bf9814b70560


More information about the All-commits mailing list