[SanitizerBinaryMetadata] Optimize used space for features and UAR stack args
authorMarco Elver <elver@google.com>
Wed, 8 Feb 2023 11:24:51 +0000 (12:24 +0100)
committerMarco Elver <elver@google.com>
Wed, 8 Feb 2023 12:12:33 +0000 (13:12 +0100)
commit3d53b52730034b9ec78871b8dcde8287dd811016
tree3cd0e047f7d35f3505eb65084259feae041a0ac7
parent938fdfc40f7efa87f6a4a9b98213f88315df27d0
[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
clang/test/CodeGen/sanitize-metadata.c
compiler-rt/test/metadata/common.h
compiler-rt/test/metadata/covered.cpp
compiler-rt/test/metadata/lit.site.cfg.py.in
compiler-rt/test/metadata/uar.cpp
llvm/include/llvm/Transforms/Instrumentation/SanitizerBinaryMetadata.h
llvm/lib/CodeGen/SanitizerBinaryMetadata.cpp
llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
llvm/test/Instrumentation/SanitizerBinaryMetadata/atomics.ll